[syslog-ng]log rotation features for syslog-ng
Gert Menke
gert@menke.za.net
Thu, 24 Jan 2002 11:10:39 +0100
Hi!
On Thu, Jan 24, 2002 at 10:03:59AM +0100, klaas.vangend@philips.com wrote:
> I'd like enhance syslog-ng with some features in order to get rid of some
> log rotation scripts.
One thing that seems particularly useful to me is rotating the logs after a
certain amount of time, 14 days for example. But in my opinion it is not
necessary to implement this feature in syslog-ng; here's what I do:
I let syslog-ng write all its logs to a directory named "current", which is
in fact a symlink to a directory named, for example, "2002-01-24".
I rotate the logs with a script that is run by cron. This script creates a
new directory and changes the "current"-symlink. Then it sends a SIGHUP to
syslog-ng, which makes it reopen all the logfiles in the new directory.
Then my script compresses the old logfiles.
You could very easily do something similar to solve your problem, but if
you want to get rid of rotation scripts, as you said, then this is probably
not what you want.
> I'd to know wheter everyone agrees that these features are a good idea,
> and that the proper approach is taken to
> keep the configurationfile syntax simple.
Well, I believe that it is difficult to implement something that gives you
the same flexibility that you have with log rotation scripts. Perhaps you
youd create a destination driver that can rename the logfile, open a new
one and run a specified script when some condition occurs? Or you can run a
script based on the return code of another script. No, that sucks too.
The more I think of it, the more I believe that my log rotation scripts
aren't that bad... :-)
Greetings
Gert