Bug 2103 - RFE: logrotate needs a way to mail recent log, not just oldest
Summary: RFE: logrotate needs a way to mail recent log, not just oldest
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: logrotate
Version: 5.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Erik Troan
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-04-10 01:03 UTC by redhat-bug-fixer
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 1999-06-16 20:49:17 UTC
Embargoed:


Attachments (Terms of Use)

Description redhat-bug-fixer 1999-04-10 01:03:18 UTC
It would be really nice if logrotate had a way to send
mail with the log file that was just rotated, instead
of only the one that's about to be removed from the end
of the rotation.

E.g., I've got a setup where I keep 31 days of logs,
rotated daily.  I'd like to get mail each night with
the previous day's logs, instead of the logs from a
month ago.

I've chatted with Erik about this via e-mail briefly,
and I plan on fetching the source for logrotate and
creating and submitting a patch...

Comment 1 redhat-bug-fixer 1999-04-10 02:46:59 UTC
I have an initial pass at a patch.

It seems to work both with and without compression enabled
and with either the 'mailfirst' or 'maillast' option (that's
how I chose to mark it -- this could of course be changed).

I do notice one problem with it, though, and that is that the
mail gets sent before the log file is rotated, which in the
case of mailfirst, means that we actually end up mailing the
active file.  I suspect the whole mail routine should be moved
to after the rotation of the main file, and probably even after
the postrotate scripts have run, but before the removal of the
last file happens.  However, I'm going to leave that for someone
else to do (maybe I'll do it some day in the future), as I'm not
real familiar with this code, and I don't want to take the time
right now to figure out the intracacies of any inter-dependancies
that might exist in order-of-execution of these various commands.

While I was at it, I fixed a typo in the man page (that was
referenced in semi-related bug #1932

Here are the patches:

http://www.daveltd.com/src/hacks/logrotate.mailfirst.diff

Note that the above also includes changes to remove end-of-line
whitespace (a pet peeve of mine).  If you want the diffs without
that, they are available too, here:

http://www.daveltd.com/src/hacks/logrotate.mailfirst.diff-w

Comment 2 redhat-bug-fixer 1999-04-10 02:47:59 UTC
Oh, I forgot to mention, the changes that I made were against the
code that I found as 'logrotate-2.5.tar.gz' in the ftp archive.


Note You need to log in before you can comment on or make changes to this bug.