Logs in /var/log which are governed by /etc/logrotate.d/syslog are not rotating as expected.

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 6

Issue

  • Logs in /var/log which are governed by /etc/logrotate.d/syslog are not rotating as expected.
  • Other logs are rotated correctly.

Resolution

  • Remove the offending file name

Root Cause

missingok option is not configured.
The config file /etc/logrotate.d/syslog contained the following error:


. #/var/log/spooler . .

The debug log showed the following:

error: stat of #/var/log/spooler failed: No such file or directory.

This means that the entire line including the # was taken as a file name and not as a comment.

Diagnostic Steps

  • Collect the output of logrotate in debug mode as below

    #logrotate -d /etc/logrotate.conf > /tmp/logrotate.log 2>&1
    
  • The debug run showed the following message:

    Nov 27 03:41:01 server logrotate: ALERT exited abnormally with [1]
    Nov 28 03:31:01 server logrotate: ALERT exited abnormally with [1]
     ..
    Jan  1 03:33:01 server logrotate: ALERT exited abnormally with [1]
    Jan  2 03:41:01 server logrotate: ALERT exited abnormally with [1]
    

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments