log rotation recommendations
lars+lister.freebsd at adventuras.no
Sat Mar 24 20:38:45 UTC 2007
Matthew Seaman skrev:
> Jeffrey Goldberg wrote:
>> Having recently moved from Linux (SuSE) to FreeBSD (6.2-p3) I'm
>> wondering what the recommended way of rotating logs (principally postfix
>> and apache). I see that logrotate, with which I'm familiar, is in
>> ports. I also see that there is a file /etc/newsyslog.conf, but it
>> looks like newsyslog(8) only knows about HUPping syslogd.
> Not so. The optional 7th field in /etc/newsyslog.conf can contain a
> file name to read a PID out of: that PID will be signalled when the
> log is rotated. The optional 8th column can contain the signal number
> to use -- by default SIGHUP is sent. The newsyslog.conf(5) man page
> explains all this in great detail.
> Certainly for apache, you might alternatively consider the use of
> rotatelogs(8) (comes with apache) or cronolog(8) (in ports as
> sysutils/cronolog). Or, indeed, logrotate if that's what you prefer.
It is also possible to put a call for newsyslog within a script.
Then you can do your preferred preprocessing,
call newsyslog with a specialized config for the event,
which should take care of HUPing the application,
and then do postprocessing like moving files to folders,
renaming to include the date or whatever.
More information about the freebsd-questions