Bug 445678

Summary: Enhancement to support multiple matching
Product: Red Hat Enterprise Linux 5 Reporter: Jari Turkia <redhat-bugzilla>
Component: logrotateAssignee: Tomas Smetana <tsmetana>
Status: CLOSED WONTFIX QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 5.1   
Target Milestone: rc   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-08-28 11:10:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jari Turkia 2008-05-08 14:06:54 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14

Description of problem:
Logrotate considers any wildcards matching twice for same logfile as an error. Another way of seeing is first-come-first-served -policy. That enables to specify fine-tuned options for certain files and coarse options for rest of them.

Example:
/etc/logrotate.d/httpd
/var/log/httpd/domain.com_error_log {
    daily
    rotate 10
    missingok
    notifempty
    sharedscripts
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}

/var/log/httpd/*log {
    missingok
    notifempty
    sharedscripts
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}

Now I have an error log of a single virtual host rotated on daily basis for developer's analysis. All other Apache logfiles are rotated as usual.

Normally logrotate considers that as an error condition for the same file to appear twice in the rules.

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

How reproducible:
Always


Steps to Reproduce:
1. Configure a logfile to match twice in logrotate
2. Run logrotate
3.

Actual Results:
Logrotate complained for the file appearing twice and refused to process it according to the first rule.

Expected Results:
A suitable warning should be issued and first rule should be left as is.

Additional info:
I'd suggest this patch to be applied:

diff -aur logrotate-3.7.4/config.c logrotate-3.7.4.JT/config.c
--- logrotate-3.7.4/config.c    2008-05-08 08:44:13.000000000 -0500
+++ logrotate-3.7.4.JT/config.c 2008-05-08 08:57:11.000000000 -0500
@@ -1041,12 +1041,11 @@
                        for (k = 0; k < (*logsPtr)[j].numFiles; k++) {
                            if (!strcmp((*logsPtr)[j].files[k],
                                        globResult.gl_pathv[i])) {
-                               message(MESS_ERROR,
+                               message(MESS_DEBUG,
                                        "%s:%d duplicate log entry for %s\n",
                                        configFile, lineNum,
                                        globResult.gl_pathv[i]);
-                               globfree(&globResult);
-                               return 1;
+                               continue;
                            }
                        }
                    }

Comment 1 Tomas Smetana 2008-05-09 05:56:03 UTC
New features that change the default behaviour should not appear between RHEL
releases.  I'll try to think about it and potentially implement in the upstream
release.

Comment 2 Tomas Smetana 2008-08-28 11:10:48 UTC
This is an incompatibility which should not be introduced between releases. Closing.