RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 827570 - logrotate fails to find the file to mail, with the "mailfirst" and "delaycompress" options
Summary: logrotate fails to find the file to mail, with the "mailfirst" and "delaycomp...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: logrotate
Version: 6.2
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Jan Kaluža
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks: 828095 855675
TreeView+ depends on / blocked
 
Reported: 2012-06-01 19:08 UTC by Karen Etheridge
Modified: 2012-09-09 21:11 UTC (History)
4 users (show)

Fixed In Version: logrotate-3.7.8-16.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 828095 855675 (view as bug list)
Environment:
Last Closed: 2012-08-15 16:05:59 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Patch from debian (985 bytes, text/plain)
2012-06-01 19:08 UTC, Karen Etheridge
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Debian BTS 504079 0 None None None 2012-06-01 19:08:19 UTC
Red Hat Product Errata RHBA-2012:1172 0 normal SHIPPED_LIVE logrotate bug fix update 2012-08-15 20:05:12 UTC

Description Karen Etheridge 2012-06-01 19:08:19 UTC
Created attachment 588564 [details]
Patch from debian

Description of problem:

logrotate fails to find the correct file to mail, when using "mailfirst" in combination with "delaycompress".  This is the same issue as described at: 

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=504079
http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg582133.html

I have contacted the author, Paul Martin, and he informs me that this has been fixed in Debian for years, but Red Hat has not yet taken the patch.

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

"logrotate -v" reports:
logrotate 3.8.1 - Copyright (C) 1995-2001 Red Hat, Inc.

The contents of my /etc/redhat-release file is:
CentOS release 6.2 (Final)

uname -a is:
Linux host.domain.com 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 GMT 2011 x86_64 x86_64 x86_64 GNU/Linux


How reproducible: always

Steps to Reproduce:

Use a config file like this:

    /home/foo/log/* {
        daily
        rotate 999
        compress
        dateext
        ifempty
        create 0755 foo users
        delaycompress
        olddir /home/foo/baklog

        mailfirst
        mail me
    }

run 'logrotate --force -d <config file>'.


Actual results:

This can be seen in the output when running logrotate --force -d <config file>:

    rotating pattern: /home/foo/log/*  forced from command line (999 rotations)
    olddir is /home/foo/baklog, empty log files are rotated, old logs mailed to
me
    considering log /home/foo/log/warning.log
      log needs rotating
    rotating log /home/foo/log/warning.log, log->rotateCount is 999
    dateext suffix '-20120531'
    glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
    glob finding logs to compress failed
    renaming /home/foo/log/warning.log to /home/foo/baklog/warning.log-20120531
    creating new /home/foo/log/warning.log mode = 0755 uid = 1823 gid = 100
    error: failed to open /home/foo/baklog/warning.log-20120531.gz for mailing:
No such file or directory

Expected results:

    The contents /home/foo/log/warning.log should be mailed, and the file rotated to /home/foo/baklog/warning.log-<date> (the latter does work correctly).

Additional info:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=504079
http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg582133.html

I have contacted the author, Paul Martin, and he informs me that this has been fixed in Debian for years, but Red Hat has not yet taken the patch.

In addition, he provides the working patch (also attached):

    Fixes #504079.

    If you configure logrotate with mailfirst option with dateext and
    delaycompress, logrotate doesn't send the log to the specific email
    address, because it looks at for a .gz file, which doesn't exist (It
    hasn't been compressed yet).

    Index: logrotate-3.8.1/logrotate.c
    ===================================================================
    --- logrotate-3.8.1.orig/logrotate.c    2011-12-05 16:40:06.688440279 +0000
    +++ logrotate-3.8.1/logrotate.c 2011-12-05 16:40:09.932530558 +0000
    @@ -1072,7 +1072,8 @@
            }
            /* firstRotated is most recently created/compressed rotated log */
            sprintf(rotNames->firstRotated, "%s/%s%s%s%s",
    -               rotNames->dirName, rotNames->baseName, dext_str, fileext, compext);
    +               rotNames->dirName, rotNames->baseName, dext_str, fileext,
    +               (log->flags & LOG_FLAG_DELAYCOMPRESS) ? "" : compext);
            globfree(&globResult);
            free(glob_pattern);
         } else {

Comment 2 Jan Kaluža 2012-06-04 08:45:08 UTC
Thanks for the report, I've fixed this bug upstream and added test for it:

https://fedorahosted.org/logrotate/changeset/369

I will check other debian patches too.

Comment 12 errata-xmlrpc 2012-08-15 16:05:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-1172.html


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