On 25/03/2016 13:46, lee wrote:
> 
> Hi,
> 
> is there a built-in way (like a place holder) to figure out what name a
> rotated log file has been given by logrotate?
> 
> Here's what I'm trying to do:
> 
> 
> ,---- [ cat /etc/logrotate.d/exim }
> | /var/log/exim/exim*.log {
> |         daily
> |         missingok
> |         rotate 800
> |         compress
> |         delaycompress
> |         notifempty
> |         create 640 mail mail
> |         postrotate
> |                 /usr/sbin/eximstats <name-of-rotated-file> | mail -s 
> "eximstats" root
> |         endscript
> | }
> `----
> 
> 
> I want <name-of-rotated-file> replaced with the name the log file that
> has been rotated has been renamed to.  I can think of ways to do this
> otherwise, like writing a script that figures out the name of the file,
> or using 'prerotate' instead.
> 
> It just won't make any sense if logrotate doesn't already have some kind
> of place holder for this.
> 


It depends. There are options to tell logrotate to use, or not use,
dates in the new filename, and what compression to use or not use. So
the names can vary.

By far the easiest solution is to put your "| mail" into prerotate
section. That way you know exactly what the name is. Or maybe not due to
that * in the name glob...

Perhaps look into renamecopy described in man logrotate

-- 
Alan McKinnon
alan.mckin...@gmail.com


Reply via email to