我正在尝试让 logrotate 在我的 VPS 上工作以每周轮换我的 apache 文件。目前 apache2 配置文件的内容是这样的。
"/var/www/user/site.com/logs/*.log" {
weekly
missingok
rotate 8
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null
endscript
}
Run Code Online (Sandbox Code Playgroud)
我已经离开它两个星期了,据我所知,一切都没有改变。当我从命令行模拟它时,我得到以下输出。
user@geneva:/var/lib/logrotate$ /usr/sbin/logrotate -d /etc/logrotate.d/apache2
reading config file /etc/logrotate.d/apache2
reading config info for "/var/www/user/site.com/logs/*.log"
Handling 1 logs
rotating pattern: "/var/www/user/site.com/logs/*.log" weekly (8 rotations)
empty log files are not rotated, old logs are removed
considering log /var/www/user/site.com/logs/access.log
log does not need rotating
considering log /var/www/user/site.com/logs/error.log
log does not need rotating
not …Run Code Online (Sandbox Code Playgroud) logrotate ×1