Hi,
I want to have a date string in my rotated logs, so I added extension .`date +%Y$m%d` in my /etc/logrotate.conf but it doesn't work. I have still $LOGFILE.1.gz
Can I do this via logrotate or have must I run a script via cron after logrotate runs which renames the .1.gz file?
Regards
I don't think the extension directive runs shell commands. You can do something like this with the lastaction script which I got from Debian lists (http://lists.debian.org/debian-user/2004/08/msg04714.html)
lastaction DATE=`date +%F`; mv /var/log/messages.1.gz /var/log/messages-$DATE.gz endscript
Modify to suit your needs.
On Sun, 2005-05-01 at 17:06 -0500, John Mahowald wrote:
lastaction DATE=`date +%F`; mv /var/log/messages.1.gz /var/log/messages-$DATE.gz endscript
Modify to suit your needs.
If I do so, I have to modify each file in /etc/logrotate.d . In this case I prefer a script via cron which renames all logfiles in a loop. It's less work ;)