User Tools

Site Tools


os:linux:logrotate

OS - Linux - Logrotate

Notes

Force a verbose logrotate run:

sudo logrotate -fv /etc/logrotate.conf

Not rotating /var/log/syslog

/var/log/syslog is not being rotated.

A forced run of logrotate shows the following for syslog:

rotating pattern: /var/log/syslog
 forced from command line (7 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/syslog
  log needs rotating
rotating log /var/log/syslog, log->rotateCount is 7
dateext suffix '-20160630'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
compressing log with: /bin/gzip
error: error creating output file /var/log/syslog.1.gz: File exists
log /var/log/syslog.8.gz doesn't exist -- won't try to dispose of it

Check to see if /var/log/syslog.1.gz is 0 KB.
If so, delete it and syslog rotation should now work.

Source: Raspberry Pi Stack Exchange - raspbian - Why are system logs not rotating?

Not rotating a custom log

A forced run of logrotate shows:

error: /etc/logrotate.conf:35 unknown group 'group1'

And:

error: found error in /var/log/custom.log , skipping

Check if a 'create' is used in the logrotate configuration:

create 0664 user1 group1

And check if both the user and group exist, and modify the create to use a user and group that exists. (In this case the group did not exist.)

os/linux/logrotate.txt · Last modified: 2016/06/30 10:25 by bas

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki