【发布时间】:2013-11-06 15:02:32
【问题描述】:
我的轮换似乎不起作用。如果我手动执行 logrotate,它会正常工作。运行 logrotate 是因为我可以在日志中看到它。这是我所拥有的:
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# use date as a suffix of the rotated file
dateext
# uncomment this if you want your log files compressed
#compress
# RPM packages drop log rotation information into this directory
include /etc/logrotate.d
/home/www/logs/access_log {
sharedscripts
delaycompress
size 2G
compress
dateext
maxage 30
postrotate
/usr/local/bin/apachectl -k graceful
endscript
}
有什么线索吗?
【问题讨论】:
-
您是否有定期运行
logrotate的cron作业(或其他调度程序)?它不会自己神奇地运行...... -
是的...它每次运行都会写一个日志。
-
它还在同一个文件中运行其他旋转,所以不用担心它不是靠魔法运行的。
标签: logrotate