Apache Log Rotation
On even a moderately busy server, the quantity of information stored in the log files is very large. The access log file typically grows 1 MB or more per 10,000 requests. It will consequently be necessary to periodically rotate the log files by moving or deleting the existing logs. This cannot be done while the server is running, because Apache will continue writing to the old log file as long as it holds the file open. Instead, the server must be restarted after the log files are moved or deleted so that it will open new log files.
in httpd.conf, add:
CustomLog "|/usr/local/apache/bin/rotatelogs /usr/local/apache/logs/access_log.%Y%m%d 86400 -360" common
(changing the path as needed...)
where the number 86400 is seconds to rotation (86400 is 24 hours)
and -360 is minutes offset from UTC 0 (-360 is for US Central)
and comment out any other line beginning with 'CustomLog'
this will give you logs, rotated daily, named something like:
access_log.20061101
access_log.20061102
access_log.20061103
...so you don't have to stop the server to deal with gigantic log files...
in httpd.conf, add:
CustomLog "|/usr/local/apache/bin/rotatelogs /usr/local/apache/logs/access_log.%Y%m%d 86400 -360" common
(changing the path as needed...)
where the number 86400 is seconds to rotation (86400 is 24 hours)
and -360 is minutes offset from UTC 0 (-360 is for US Central)
and comment out any other line beginning with 'CustomLog'
this will give you logs, rotated daily, named something like:
access_log.20061101
access_log.20061102
access_log.20061103
...so you don't have to stop the server to deal with gigantic log files...
Nhận xét
Đăng nhận xét