Comment 75 for bug 407862

Nikolaus Rath (nikratio) wrote :

[0] spitzer:~# logger testing

[0] spitzer:~# tail -2 /var/log/syslog
 10:08:48 beta AptDaemon: INFO: Shutdown was requested
Sep 7 10:09:42 spitzer root: testing

[0] spitzer:~# logrotate --force --verbose /etc/logrotate.conf
reading config file /etc/logrotate.conf
compress_prog is now /bin/bzip2
uncompress_prog is now /bin/bunzip2
compress_ext is now .bz2
reading config info for /var/log/wtmp
reading config info for /var/log/btmp
reading config info for /var/log/syslog

Handling 3 logs

rotating pattern: /var/log/wtmp forced from command line (1 rotations)
empty log files are not rotated, only log files >= 131072 bytes are rotated, old logs are removed
considering log /var/log/wtmp
  log needs rotating
rotating log /var/log/wtmp, log->rotateCount is 1
dateext suffix '-20110907'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
compressing log with: /bin/bzip2
renaming /var/log/wtmp.1.bz2 to /var/log/wtmp.2.bz2 (rotatecount 1, logstart 1, i 1),
renaming /var/log/wtmp.0.bz2 to /var/log/wtmp.1.bz2 (rotatecount 1, logstart 1, i 0),
old log /var/log/wtmp.0.bz2 does not exist
renaming /var/log/wtmp to /var/log/wtmp.1
creating new /var/log/wtmp mode = 0664 uid = 0 gid = 43
removing old log /var/log/wtmp.2.bz2

rotating pattern: /var/log/btmp forced from command line (1 rotations)
empty log files are not rotated, only log files >= 131072 bytes are rotated, old logs are removed
considering log /var/log/btmp
  log needs rotating
rotating log /var/log/btmp, log->rotateCount is 1
dateext suffix '-20110907'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
compressing log with: /bin/bzip2
renaming /var/log/btmp.1.bz2 to /var/log/btmp.2.bz2 (rotatecount 1, logstart 1, i 1),
renaming /var/log/btmp.0.bz2 to /var/log/btmp.1.bz2 (rotatecount 1, logstart 1, i 0),
old log /var/log/btmp.0.bz2 does not exist
renaming /var/log/btmp to /var/log/btmp.1
creating new /var/log/btmp mode = 0660 uid = 0 gid = 43
removing old log /var/log/btmp.2.bz2

rotating pattern: /var/log/syslog
 forced from command line (4 rotations)
empty log files are not rotated, only log files >= 131072 bytes are rotated, old logs are removed
considering log /var/log/syslog
  log needs rotating
rotating log /var/log/syslog, log->rotateCount is 4
dateext suffix '-20110907'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
compressing log with: /bin/bzip2
renaming /var/log/syslog.4.bz2 to /var/log/syslog.5.bz2 (rotatecount 4, logstart 1, i 4),
renaming /var/log/syslog.3.bz2 to /var/log/syslog.4.bz2 (rotatecount 4, logstart 1, i 3),
renaming /var/log/syslog.2.bz2 to /var/log/syslog.3.bz2 (rotatecount 4, logstart 1, i 2),
renaming /var/log/syslog.1.bz2 to /var/log/syslog.2.bz2 (rotatecount 4, logstart 1, i 1),
renaming /var/log/syslog.0.bz2 to /var/log/syslog.1.bz2 (rotatecount 4, logstart 1, i 0),
old log /var/log/syslog.0.bz2 does not exist
renaming /var/log/syslog to /var/log/syslog.1
creating new /var/log/syslog mode = 0664 uid = 0 gid = 4
running postrotate script
removing old log /var/log/syslog.5.bz2

[0] spitzer:~# logger testing
[0] spitzer:~# tail /var/log/syslog
[0] spitzer:~# tail -2 /var/log/syslog.1
Sep 7 10:08:48 beta AptDaemon: INFO: Shutdown was requested
Sep 7 10:09:42 spitzer root: testing

==> no more messages in syslog.

Note that for testing I disabled inclusion of logrotate.d in logrotate.conf and just added one entry for syslog to logrotate.conf directly:

# system-specific logs may be configured here
/var/log/syslog
{
    postrotate
>-------reload rsyslog >/dev/null 2>&1 || true
    endscript
    sharedscripts
}

Replacing the "reload" with "restart" works around the problem.