syslog-ng's logrotate config should use delaycompress (loses messages)

Bug #361204 reported by Daniel Hahler
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
syslog-ng (Debian)
Fix Released
Unknown
syslog-ng (Ubuntu)
Fix Released
High
Unassigned

Bug Description

Binary package hint: syslog-ng

I've just noticed that when using logrotate for files handled by syslog-ng (containing messages received from remote syslog-ng instances), that messages are lost, if syslog-ng is not being reloaded after the logfiles got compressed.

I've been using the following in a own file in /etc/logrotate.d:
/var/log/HOSTS/* {
       weekly
       rotate 7
       compress
       notifempty
       missingok
}

The shipped /etc/logrotate.d/syslog-ng contains "/usr/sbin/invoke-rc.d syslog-ng reload >/dev/null" as postrotate script in the last block.

It appears that all messages that are targeted at auth.log (the first block) will get discarded while the other blocks get processed, until syslog-ng gets reloaded.

Therefore I think that the "delaycompress" option should get used, so that messages after rotation, but before the reload of syslog-ng will get written to the foo.log.1 file.

I've not verified this (e.g. by testing it explicitly or looking at the source), but the compressed log files last entries are from 2009-04-12 22:xx (where I've manually executed "logrotate /etc/logrotate.d/HOSTS") and the new files begin at 2009-04-13 06:xx (when syslog-ng gets reloaded due to the logrotate cronjob).
Oddly, there's one logfile, where entries have been written in the meantime (although only "<syslog.info> mydb -- MARK --" - it's a MySQL container which is usually "silent").
I'm not sure if I have manually reloaded syslog-ng (after the manual run of logrotate), but according to the logs I have not.

The OpenVZ hardware node runs Hardy, as do the containers/guests.
logrotate 3.7.1-3ubuntu0.8.04
syslog-ng 2.0.9-1ubuntu1

Revision history for this message
Daniel Hahler (blueyed) wrote :

Raising importance to High (loss of messages/information).

I've asked Balazs Scheidler (upstream) about it and he replied:
your analysis seems to be correct, there's a race between log rotation
and the processing of the SIGHUP signal.

I'll forward this to Debian.

Changed in syslog-ng (Ubuntu):
importance: Undecided → High
Changed in syslog-ng (Debian):
status: Unknown → New
Daniel Hahler (blueyed)
summary: - syslog-ng's logrotate config should use delaycompress (lost messages)
+ syslog-ng's logrotate config should use delaycompress (loses messages)
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Since there are 2 people affected, marking this as Confirmed.

Changed in syslog-ng (Ubuntu):
status: New → Confirmed
Daniel Hahler (blueyed)
Changed in syslog-ng (Ubuntu):
status: Confirmed → Triaged
Changed in syslog-ng (Debian):
status: New → Fix Released
Revision history for this message
Daniel Hahler (blueyed) wrote :

Marking "Fix released" according to the Debian report, which says that it is included in Debian since Squeeze.

Changed in syslog-ng (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.