Apache 日志按天保存 waynewu 2009-4-24
1 首先编写httpd.log.conf,内容如下
/usr/local/apache2.29/logs/access.log {
daily
rotate 5
copytruncate
compress
notifempty
missingok
# This script asks squid to rotate its logs on its own.
# Restarting squid is a long process and it is not worth
# doing it just to rotate logs
postrotate
/bin/kill -1 `cat /usr/local/apache2.29/logs/httpd.pid`
endscript
}
2 加入crontab
00 00 * * * /usr/sbin/logrotate -f /usr/local/apache2.29/conf/httpd.log.con
阅读(1956) | 评论(0) | 转发(0) |