[syslog-ng]log rotation not completing

Ed Ravin eravin@panix.com
Fri, 15 Feb 2002 10:32:30 -0500 (EST)


Nate Campi writes:
> 
> On Fri, Feb 15, 2002 at 04:52:24AM -0600, Len Conrad wrote:
> > We have FreeBSD newsyslog rotate /var/log/maillog and 
> > /var/log/pop-before-smtp at 00:00. the rotation is working, we get the 
> > .0.gz files and new log files, but newsyslog-ng is apparently not receiving 
> > or reacting to the -HUP

> I hate to imply you didn't cover the basics, but are you sure that
> newsyslog is sending the HUP to the right PID? Maybe it's trying to
> 'kill -HUP `cat /var/run/syslogd.pid' when the PID file is
> /var/run/syslog-ng.pid?
> 
> I don't know how FreeBSD HUPs the syslog daemon, but it could be
> something like this.

I don't know how FreeBSD does its HUPs either, but if it's using the
same "newsyslog" command that NetBSD uses, then that would explain
the problem.  NetBSD "newsyslog" looks for the syslogd.pid file, and
sends a HUP to that process after each file rotation.  Worse yet, it
doesn't do much sanity checking on the PID file, so even if the
process listed in that file doesn't exist, "newsyslog" marches on -
you might find a bunch of error messages like "impossible process number -
0" in your cron log.  Oh, and though it's not relevant to this post,
if you have an erroneous user name or other syntax error in the
newsyslog.conf file, it aborts the entire run.

In your syslog-ng startup parameters, you could tell syslog-ng to use
"syslogd.pid" as its pidfile, or if there is a startup script, you could
use a symlink to point syslogd.pid to syslog-ng.pid.  That would get you
into trouble if you need to run both the old and the new syslogd, and it
might complicate the startup scripts.

Another option is to use date templates in your log file names, so
they'll roll over automatically and you can archive or delete the
old ones with a separate script.