Rsyslog

Logrotate:glob 查找舊的旋轉日誌失敗

  • December 9, 2019

我在使用 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

問題已解決

logrotate -f /etc/logrotate.d/syslog

沒有“v”選項。

引用自:https://serverfault.com/questions/962682