From: lee <lee@yagibdah.de>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] logrotate: name of log file after it's rotated?
Date: Sat, 02 Apr 2016 04:01:54 +0200 [thread overview]
Message-ID: <87h9fklqel.fsf@heimdali.yagibdah.de> (raw)
In-Reply-To: <56F5A0DD.1060004@gmail.com> (Alan McKinnon's message of "Fri, 25 Mar 2016 22:34:37 +0200")
Alan McKinnon <alan.mckinnon@gmail.com> writes:
> 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.
Exactly, and that's why there needs to be some sort of place holder for
the file name.
> 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...
The problem is that the file can be written to while it is being
examined when the examination is performed before it is rotated. That
can lead to false results of the examination.
> Perhaps look into renamecopy described in man logrotate
Thanks, that sounds as if it will provide exactly what I'm looking for
:)
next prev parent reply other threads:[~2016-04-02 2:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-25 11:46 [gentoo-user] logrotate: name of log file after it's rotated? lee
2016-03-25 20:34 ` Alan McKinnon
2016-04-02 2:01 ` lee [this message]
2016-04-02 6:51 ` Alan McKinnon
2016-04-02 8:07 ` Neil Bothwick
2016-04-02 15:21 ` [gentoo-user] About gentoo linux PCI passthrough Nicol TAO
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h9fklqel.fsf@heimdali.yagibdah.de \
--to=lee@yagibdah.de \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox