Apache is still relatively cool, with its own Rotatelog program, edit the Apache master configuration file, the following changes:
Comment out the following two lines
Errorlog Logs/error_log
Customlog Logs/access_log Common
Then add the following two lines
Errorlog "|bin/rotatelogs logs/errorlog.%y-%m-%d-%h_%m_%s 2M +480″
Customlog "|bin/rotatelogs logs/accesslog.%y-%m-%d-%h_%m_%s 2M +480″common
The meanings are as follows:
errorlog.%y-%m-%d-%h_%m_%s is the format of the generated log, similar to the following: Errorlog.2010-04-15-11_32_30, in days and minutes and seconds,
2M is the size of the log, that is, when the log reaches a new log file, the supported units are K,M,G, the department is 2M
+480 is the time difference, the file is in the United States time, China's jet lag is 8 hours more than the United States is 480 minutes, so add 480 minutes
There are other ways to set this up:
Generate an error log file every day
Errorlog "|bin/rotatelogs.exe-l Logs/error-%y-%m-%d.log 86400″
Where 86400 is the time unit of rotation in seconds
This article is from the "Target: India" blog, please be sure to keep this source http://shunzi115.blog.51cto.com/5184443/1825941
Apache Log Cutting