Bug 113764 - Logrotate does not 'mailfirst'
Logrotate does not 'mailfirst'
Status: CLOSED DUPLICATE of bug 100546
Product: Red Hat Linux
Classification: Retired
Component: logrotate (Show other bugs)
9
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Elliot Lee
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-01-17 08:18 EST by David Tonhofer
Modified: 2007-04-18 13:01 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-02-21 14:00:48 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description David Tonhofer 2004-01-17 08:18:33 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5)
Gecko/20031007

Description of problem:
I have the situation where logrotate does not mail the
file-about-to-be-rotated under RH9.0 ('mailfirst'), though an
identical setup works under RH7.3. 

Here's a logrotate block in "/etc/logrotate.d/httpd" on the
RH9.0 system, which does not mail (N.B. there are other blocks
in the same /etc/logrotate.d/httpd file):

-------------------------------------------
/var/log/httpd/error_log {
    daily
    rotate 65
    nomissingok
    ifempty
    olddir /var/log/httpd/error_dir
    create 640 root mpfyrun
    mail zaibatsu@m-plify.com
    mailfirst
    compress
    delaycompress
    postrotate
        /usr/local/apache2/bin/apachectl graceful
        # there will be some activity on the saved log, so don't
        # compress
        # if you want to compress, sleep for 600 or use delaycompress
        # echo "Rotated httpd error_log"
    endscript
}
-------------------------------------------

Logrotate has the following /etc/logrotate.conf file:

-------------------------------------------
less /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
    rotate 1
}

# system-specific logs may be also be configured here.
-------------------------------------------

The same block works under RH7.3 (i.e. it mails). For the RH7.3 case,
the logrotate.conf is identical.

The solution was to add a preprotate entry, like so:

    prerotate
        /usr/local/mplify/sbin/check_httpd_error_log.pl < 
          /var/log/httpd/error_log 2>&1 | mail -s 
          "SYSOP: `hostname`/HTTPd error log" techies@m-plify.com
    endscript

Another block for mysql using 'mailfirst' works under RH9.0.
Here it is:

----------------------------------------
/var/log/mysql/error_log {
      daily
      rotate 30
      nomissingok
      notifempty
      nocreate
      mailfirst
      olddir /var/log/mysql/error_dir
      mail techies@m-plify.com
      copytruncate
      postrotate
        chown mysql.mysql /var/log/mysql/error_log
        chmod 660 /var/log/mysql/error_log
        # echo "Rotated the myslq error_log"
      endscript
}
----------------------------------------

Version-Release number of selected component (if applicable):

logrotate-3.6.8-1

How reproducible:
Didn't try


Actual Results:  The file-about-to-be-rotated-away does not arrive in
the inbox

Expected Results:  The file-about-to-be-rotated-away should arrive in
the inbox

Additional info:
Comment 1 Elliot Lee 2004-02-20 15:17:10 EST
This has since been fixed - grab the Fedora Core 1 logrotate if you
want a fix, and see #100546 for details.

*** This bug has been marked as a duplicate of 100546 ***
Comment 2 Red Hat Bugzilla 2006-02-21 14:00:48 EST
Changed to 'CLOSED' state since 'RESOLVED' has been deprecated.

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