logrotate naming of files by date

Matthew Hall matt at ecsc.co.uk
Thu Apr 15 09:51:21 UTC 2004


On Thu, 2004-04-15 at 11:41 +0300, Marius Andreiana wrote:
> Is there possible to make logrotate name the files by date? We'd like to
> keep archives of logs named as yyyy-mm-dd.

You might be able to do this quite simply with a 'postrotate' script
(check 'man 8 logrotate'). You could do something along the lines of:

postrotate
	date=`date +%Y-%m-%d`
	mv /var/log/mylog.1.gz /var/log/mylog-$date.gz
endscript

Hth,
Matt
-- 
- -- --- ---- ------------------------------------ ---- --- -- -
Matthew Hall
http://people.ecsc.co.uk/~matt/
Sig: Pohl's law: Nothing is so good that somebody, somewhere, will not hate it.
- -- --- ---- ------------------------------------ ---- --- -- -
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20040415/18a4eff6/attachment-0001.sig>


More information about the fedora-list mailing list