Automatic tuning the begin and end log id