syslog log rotation

Olaf Titz olaf at bigred.inka.de
Tue Apr 24 23:03:04 UTC 2001


> In short, anything that deals with files that syslog is writing must
> assume that syslog can be reloaded at any time, and therefore must
> never create a window where a filename that syslog is configured to
> write to does not exist.

Why? As I see it the rotating program should not create the new log
file at all, since syslog will do that as soon as it is reloaded (and
at the same moment the old one gets closed). This is the same as with
handling batch files from INN. This should work:

    for F in ${SYSLOGS}; do
      rm -f ${F}.old
      mv ${F} ${F}.old
    done
    hupsyslogd
    ctlinnd -s logmode

It is the manual creation of the new log file which creates the race.
Or are there syslogds braindamaged enough that they can't handle this?

> My $0.02: integrate it.  What INN currently does (zeroing files that
> syslog is actively writing to) is a hack.  (Making a setuid-root
> hupsyslogd program is arguably also a hack, but IMO, it's a much
> cleaner one.)

What I do is to let the system's logrotate handle it, but
unfortunately every system does that differently...

Olaf


More information about the inn-workers mailing list