Apparently, Clint Adams wrote:
% [Cc:ing Gert-Jan Hagenaars, since he implemented -d]
%
% On Tue, Sep 23, 2008 at 09:24:07PM +0200, Paul Slootman wrote:
% > > There's no rotation capability with -d or -D. Perhaps this should be
I don't see a "-D" in the current savelog implementation on my system.
Am I behind?
% > Ugh :(
% > Surely that wouldn't be too difficult to do? Something like:
% >
% > ls -t1 $base.* | tail --lines=+cycles | xargs --no-run-if-empty rm
% >
% > with some appropriate checks built in... Without rotation, I don't
% > really see the point of savelog, I might as well roll my own in my
% > scripts.
You really don't "rotate" when you use dates. You can expire them (based
on age), or retain them (based on number of logs), both different concepts
from rotating cycles. I didn't implement either expire or retain, since
it didn't offer any immediate significant value to the savelog script; you
can rotate logs, or you can archive them by date. As I said at the time:
This gives you the ability to roll the logs and keep them around
forever.
Very nice for web / mail / security logs.
Not having rotation with one specific option may seem pointless to some,
but that doesn't mean that the whole script is now useless. Note that
without rotation, savelog still does what its name says it will do:
it will save logs. "savelog" is not called "logrotate" or "rotatelog".
Personally, I also like the fact that I can *see* if I'm dealing with
auto-rotating logs or auto-archiving logs by the name. If it uses a
number, it rotates, if it uses a date, it saves. However, this is not
obvious from the man page.
% The checks would need to ensure that those files corresponded to the
% date format, I imagine.
Expiring log files based on dates *safely* is not trivial.
% > > documented, and perhaps -c should cause a fatal error if -d or -D is
% > > specified.
Yikes, that's pretty heavy handed. Savelog is a program that is typically
not invoked from the command line (if it were, this thread wouldn't
have come up). That means that a "fatal error" will not be quickly caught
when the program runs unless in very specific circumstances. It can also
potentially break existing setups. I don't think that is a good idea.
% > I fully agree, the current behaviour sucks; giving an error when a
% > non-supported combination of options is given is the least that could be
% > done. The documentation will of course also need to be fixed.
%
% Well, I'll do those unless someone has a better idea.
I would argue that we say "-d disables cycling" and make it complain
when both "-c" and "-d" are invoked at the same time, but don't make
it stop working. Always be liberal in what you accept. Besides, this
would be a fairly trivial change to savelog.
Anything that deals with log files should be (a) robust (i.e. keep
working as much as possible) and (b) careful (don't throw away data).
CHeers,
GertJan.
--
+++++++++++++ -------- +++++ --- ++ - +0+ + ++ +++ +++++ ++++++++ +++++++++++++
sed '/^[when][coders]/!d G.J.W. Hagenaars -- gj at hagenaars dot com
/^...[discover].$/d Remembering Mike Carty 1968-1994
/^..[real].[code]$/!d UltrixIrixAIXHPUXSunOSLinuxBSD, nothing but nix
' /usr/dict/words I'm Dutch, what's _your_ excuse?
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]