I'm trying to do some processing on an exim log, but my script is not receiving the rotated log file name as a parameter - rather, it's getting the original log file name (which no longer exists)
/var/log/exim/*log" {
daily
rotate 3650
delaycompress
missingok
notifempty
nosharedscripts
postrotate
echo $0 $1 $2 >> /tmp/out
/path/to/script $1
endscript
}
The results in /tmp/out:
logrotate_script /var/log/exim/main.log
I'm running
logrotate --force -v /etc/logrotate.conf
Output seems to indicate that it's renaming, then running:
renaming /var/log/exim/main.log to /var/log/exim/main.log-20160105
running postrotate script
This is on an amazon linux instance. I've tried it with both sharedscripts and nosharedscripts options with no difference.
How can I get the old renamed file name?
If result log file is (logfilepath).(log)-(20160105) formated, Maybe you can try this:
If you want (logfilepath)-(20160105).(log) format, youcan use:
with $1 return logfilepath