Bug 445678 - Enhancement to support multiple matching
Enhancement to support multiple matching
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: logrotate (Show other bugs)
5.1
i686 Linux
low Severity low
: rc
: ---
Assigned To: Tomas Smetana
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-05-08 10:06 EDT by Jari Turkia
Modified: 2008-08-28 07:10 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-08-28 07:10:48 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jari Turkia 2008-05-08 10:06:54 EDT
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 01:56:03 EDT
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 07:10:48 EDT
This is an incompatibility which should not be introduced between releases. Closing.

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