我在使用 logrotate 时遇到了问题。配置如下
/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
/var/log/unused.log
/var/log/kern.log
/var/log/daemon.log
{
#Modified by CGSL!
compress
dateext
maxage 90
rotate 100
missingok
notifempty
size +4096k
create 640 root root
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
我感兴趣的是旋转 /var/log/daemon.log,执行的输出
logrotate -fv /etc/logrotate.d/syslog
是
reading config file /etc/logrotate.d/syslog
reading config info for /var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
/var/log/unused.log
/var/log/kern.log
/var/log/daemon.log
Handling 1 logs
rotating pattern: /var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
/var/log/unused.log
/var/log/kern.log
/var/log/daemon.log
forced from command line (100 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/cron
log needs rotating
considering log /var/log/maillog
log needs rotating
considering log /var/log/messages
log needs rotating
considering log /var/log/secure
log needs rotating
considering log /var/log/spooler
log does not need rotating
considering log /var/log/unused.log
log needs rotating
considering log /var/log/kern.log
log needs rotating
considering log /var/log/daemon.log
log needs rotating
rotating log /var/log/cron, log->rotateCount is 100
dateext suffix '-20190411'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
rotating log /var/log/maillog, log->rotateCount is 100
dateext suffix '-20190411'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
rotating log /var/log/messages, log->rotateCount is 100
dateext suffix '-20190411'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
destination /var/log/messages-20190411.gz already exists, skipping rotation
rotating log /var/log/secure, log->rotateCount is 100
dateext suffix '-20190411'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
rotating log /var/log/unused.log, log->rotateCount is 100
dateext suffix '-20190411'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
rotating log /var/log/kern.log, log->rotateCount is 100
dateext suffix '-20190411'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding old rotated logs failed
rotating log /var/log/daemon.log, log->rotateCount is 100
dateext suffix '-20190411'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding old rotated logs failed
set default create context
这个错误是什么意思?
glob finding old rotated logs failed
答案1
问题已解决,使用
logrotate -f /etc/logrotate.d/syslog
没有“v”选项。