get the timestamp as a log filename

Robin Laing Robin.Laing at drdc-rddc.gc.ca
Thu Jan 22 20:17:09 UTC 2004


Genti A. Hila wrote:
> I think I didn't explain it quite well:
> I have some log files that are saved from logrotate  hourly.
> But what i get is something like message.1 messages.2 etc
> Instead of this i would like to have something like
> mesagges_04\01\21_14\00
> messages_04\01\21_13\00
> So to follow the format  messages_yy\mm\dd\_hour\minute
> Something like that, the idea is to have the time as the name of the file
> 
> 
> Genti
> 
> 
You may have to write a script to run as part of the logrotate 
configuration.  There is an ability to have a script execute after the 
rotation.

There are different ways of calling the script.

I am not sure if the "extension" will work for what you want.

Maybe this would be better as a cron feature than logrotate as it 
sounds that you want to keep a running record of log files, not just 
rotate them.

-- 
Robin Laing





More information about the fedora-list mailing list