Re: more contrib: log rotator - Mailing list pgsql-hackers

From Giles Lean
Subject Re: more contrib: log rotator
Date
Msg-id 3922.1049665704@nemeton.com.au
Whole thread Raw
In response to Re: more contrib: log rotator  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:

> Seems like a good bare-bones file writer; but how about all those
> frammishes that people ask for like generating date-based filenames,
> switching every so many bytes, etc?  Also, it'd be nice not to be
> dependent on a cron job to tickle the switchover.

One of the earlier times this discussion came up I wrote a log
rotation program too.  It will rotate based on time, file size,
and/or SIGHUP:
   ftp://ftp.nemeton.com.au/pub/src/logwrite-1.0alpha.tar.gz

Written in C, BSD license, used on my production systems.  Needs to be
updated to not have 'alpha' in the URL ... no bug reports in 18 months
means that it could at least be beta. ;-) It should be portable: I've
built it on *BSD, HP-UX, and Linux at least.  I'd need help for
Windows.

I took pains to deal with some of the concerns Tom raised last time
about not giving up and exiting when a filesystem fills up.  This is
something that the Apache rotatelogs program didn't do at the time I
looked at it, else I'd have not written this at all.

> I too would rather this functionality were integrated into the server,
> but I haven't noticed anyone stepping up to the plate to do it.

Shouldn't be hard: the server only has to create a pipe, and run the
log rotation program.  For extra robustness re-starting the log
rotation program if it exits ("don't kill -9 the log rotator") is a
good idea.

I'll look at doing this, unless the discussion heads somewhere else
e.g., if Peter decides to integrate his code.  The server changes are
probably independent of whichever log rotation program is preferred
anyway.

Regards,

Giles



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: more contrib: log rotator
Next
From: Andrew Sullivan
Date:
Subject: Re: more contrib: log rotator