Need to make sure my understanding of newsyslog is correct for a
daemon I'm writing
af300wsm at gmail.com
Fri Jan 5 19:04:58 UTC 2007
I'm working on the finishing touches to a server program I've just written
and one of the things it needs to log information to a log file. I'm going
to log to /var/log/file.log and to manage the growth I'm going to add this
log file to the newsyslog.conf file. However, I'd like to make sure that
the code I'm writing will work with how newsyslog is going to work.
Basically, I'm installing a signal handler for SIGHUP to do the following:
reset the put pointer to the beginning of the file;
flush any data that may be in the buffer;
close the file;
Does this sound correct? I'm going on the assumption (and this is what I
want to have clarified) that newsyslog, when it finds that file x meets the
rotate criteria, follows these steps:
1) copy file x contents to x.0
2) truncate file x to zero bytes
3) send SIGHUP to process id
Is this how newsyslog would truncate the file? Am I missing something?
Should my signal handler function look differently?
Thanks for any help,
More information about the freebsd-questions