get the timestamp as a log filename
Bevan C. Bennett
bevan at fulcrummicro.com
Fri Jan 23 18:31:10 UTC 2004
> which does not produce a file name that sorts the way I like.
> I would use something like...
>
> $ date +"%Y-%m-%d_%R"
> 2004-01-23_09:01
That's highly recommended, although %Y-%m-%d generally suffices, since
logrotate won't run more than once per day unless forced.
Dropping something like the following in the appropriate section of
logrotates.conf or logrotate.d appears to work splendidly, if you want
to keep these logs indefinately. You may also want to use 'rotate 0'.
I used /etc/logrotate.d/rpm for testing:
postrotate
/bin/cp /var/log/rpmpkgs.1 /var/log/rpmpkgs-`/bin/date +"%Y-%m-%d-%R"`
endscript
More information about the fedora-list
mailing list