这是我的日志目录:
root@my-server:/var/www/vhosts/my-website/logs# ll
total 1468016
-rw-r--r-- 1 my-website webuser 95719295 Mar 19 18:04 my-website-access.log
-rw-r--r-- 1 my-website webuser 21130452 Apr 27 2019 my-website-access.log.4.gz
-rw-r--r-- 1 my-website webuser 831892 Mar 17 15:39 my-website-error.log
-rw-r--r-- 1 root root 1238469639 Mar 19 18:04 my-website-ssl-access.log
-rw-r--r-- 1 root root 20 Mar 19 17:55 my-website-ssl-access.log.3.gz
-rw-r--r-- 1 root root 16976113 Mar 2 2019 my-website-ssl-access.log.9.gz
-rw-r--r-- 1 root root 102746845 Mar 19 18:04 my-website-ssl-error.log
-rw-r--r-- 1 my-website webuser 21089307 Mar 19 18:03 test.my-website-access.log
-rw-r--r-- 1 my-website webuser 6243491 Mar 17 18:48 test.my-website-error.log
请注意,那里有一个巨大的 > 1GB 文件。这是我的 logrotate 配置文件:
/var/www/vhosts/*/logs/*.log {
rotate 8
daily
size 256M
compress
delaycompress
sharedscripts
postrotate
/bin/systemctl reload apache2 > /dev/null
endscript
}
当我运行命令时:
logrotate -vv -f /etc/logrotate.d/vhost
它似乎正在工作,我收到了这些消息(以及许多其他噪音):
considering log /var/www/vhosts/my-website/logs/my-website-ssl-access.log
log needs rotating
...
rotating log /var/www/vhosts/my-website/logs/my-website-ssl-access.log, log->rotateCount is 8
dateext suffix '-20200319'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /var/www/vhosts/my-website/logs/my-website-ssl-access.log.1 does not exist
renaming /var/www/vhosts/my-website/logs/my-website-ssl-access.log.8.gz to /var/www/vhosts/my-website/logs/my-website-ssl-access.log.9.gz (rotatecount 8, logstart 1, i 8),
old log /var/www/vhosts/my-website/logs/my-website-ssl-access.log.8.gz does not exist
renaming /var/www/vhosts/my-website/logs/my-website-ssl-access.log.7.gz to /var/www/vhosts/my-website/logs/my-website-ssl-access.log.8.gz (rotatecount 8, logstart 1, i 7),
old log /var/www/vhosts/my-website/logs/my-website-ssl-access.log.7.gz does not exist
renaming /var/www/vhosts/my-website/logs/my-website-ssl-access.log.6.gz to /var/www/vhosts/my-website/logs/my-website-ssl-access.log.7.gz (rotatecount 8, logstart 1, i 6),
old log /var/www/vhosts/my-website/logs/my-website-ssl-access.log.6.gz does not exist
renaming /var/www/vhosts/my-website/logs/my-website-ssl-access.log.5.gz to /var/www/vhosts/my-website/logs/my-website-ssl-access.log.6.gz (rotatecount 8, logstart 1, i 5),
old log /var/www/vhosts/my-website/logs/my-website-ssl-access.log.5.gz does not exist
renaming /var/www/vhosts/my-website/logs/my-website-ssl-access.log.4.gz to /var/www/vhosts/my-website/logs/my-website-ssl-access.log.5.gz (rotatecount 8, logstart 1, i 4),
old log /var/www/vhosts/my-website/logs/my-website-ssl-access.log.4.gz does not exist
renaming /var/www/vhosts/my-website/logs/my-website-ssl-access.log.3.gz to /var/www/vhosts/my-website/logs/my-website-ssl-access.log.4.gz (rotatecount 8, logstart 1, i 3),
old log /var/www/vhosts/my-website/logs/my-website-ssl-access.log.3.gz does not exist
renaming /var/www/vhosts/my-website/logs/my-website-ssl-access.log.2.gz to /var/www/vhosts/my-website/logs/my-website-ssl-access.log.3.gz (rotatecount 8, logstart 1, i 2),
renaming /var/www/vhosts/my-website/logs/my-website-ssl-access.log.1.gz to /var/www/vhosts/my-website/logs/my-website-ssl-access.log.2.gz (rotatecount 8, logstart 1, i 1),
old log /var/www/vhosts/my-website/logs/my-website-ssl-access.log.1.gz does not exist
renaming /var/www/vhosts/my-website/logs/my-website-ssl-access.log.0.gz to /var/www/vhosts/my-website/logs/my-website-ssl-access.log.1.gz (rotatecount 8, logstart 1, i 0),
old log /var/www/vhosts/my-website/logs/my-website-ssl-access.log.0.gz does not exist
log /var/www/vhosts/my-website/logs/my-website-ssl-access.log.9.gz doesn't exist -- won't try to dispose of it
rotating log /var/www/vhosts/my-website/logs/my-website-ssl-error.log, log->rotateCount is 8
dateext suffix '-20200319'
...但是大型日志文件似乎没有被轮换,尽管 logrotate 显然说它有:
-rw-r--r-- 1 root root 1238469639 Mar 19 18:04 my-website-ssl-access.log
知道会发生什么吗?