Bug 2103 - RFE: logrotate needs a way to mail recent log, not just oldest
RFE: logrotate needs a way to mail recent log, not just oldest
Product: Red Hat Linux
Classification: Retired
Component: logrotate (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Erik Troan
Depends On:
  Show dependency treegraph
Reported: 1999-04-09 21:03 EDT by redhat-bug-fixer
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 1999-06-16 16:49:17 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description redhat-bug-fixer 1999-04-09 21:03:18 EDT
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-09 22:46:59 EDT
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:


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:

Comment 2 redhat-bug-fixer 1999-04-09 22:47:59 EDT
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.