Subject: Re: log files and rotation
To: Chris G Demetriou <Chris_G_Demetriou@ux2.sp.cs.cmu.edu>
From: Curt Sampson <curt@portal.ca>
List: current-users
Date: 08/05/1996 13:14:41
> In my opinion (no humility claimed 8-), log files should be rotated at
> well-known intervals (i.e. daily, every two days, weekly, or
> whatever), at well known times, and only at those times and intervals.
>
> You need that to be able to tell, from a given date/time, what
> activity went on then. I'd also say that the default rotation sizes,
> given their existence at all, are way too small...
I don't understand why you need this. You can always just look at
the dates of the old logfiles to see the range each one covers
(excepting the first, of course), and each entry in each logfile
is dated, anyway.
Well, I have my troubles with newsyslog, I think that putting a
maximum size on the amount of logs you wish to keep and keeping
logs as far back as one can, given that size limitation, is a good
feature to have available.
> Unfortunately, nothing run from cron can really do what I want
> (since if the system is down for a day, i.e. cron is not running,
> the jobs for that day won't happen, and i want rotation to happen in
> this case immediately after system startup).
That's easily enough solved by running the newsyslog-like program on
system startup as well as hourly (or whenever) from cron.
> Newsyslog actually gets part of the way there, but it has the annoying
> property that the rotation times can wander around the clock.
Yes. I think that newsyslog is missing the following:
o The ability to fix a rotation time, rather than basing it on
a time in the inode.
o The ability to send signals to arbitrary processes
o The ability to rotate a file based on how long it's been since it
was last modified.
o The ability to run arbitrary programs when a logfile is rotated.
o The ability to wait a specified (and possibly long) interval between
the time a logfile is rotated and the time the old logfile is gzipped.
This isn't a complete list. :-)
I occasionally think about adding various things like this to
newsyslog, but in the end stumble over a way to add all sorts of
features and yet make the config file backwards compatable. I don't
think it can be done, really. One day perhaps I'll sit down and
work out a proper config file format, after which writing the
program will be trivial. :-)
cjs
Curt Sampson curt@portal.ca Info at http://www.portal.ca/
Internet Portal Services, Inc.
Vancouver, BC (604) 257-9400 De gustibus, aut bene aut nihil.