Bug 948778 - pre and post scripts run for all wildcarded logs
Summary: pre and post scripts run for all wildcarded logs
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: logrotate
Version: 19
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Jan Kaluža
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-04-05 12:15 UTC by Luke Campbell
Modified: 2013-05-22 03:09 UTC (History)
2 users (show)

Fixed In Version: logrotate-3.8.4-1.fc19
Clone Of:
Environment:
Last Closed: 2013-05-22 03:09:44 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Luke Campbell 2013-04-05 12:15:23 UTC
Description of problem:
I am not sure if this is a bug, but according to the man page for logrotate, pre/post scripts should only be run for log files that WILL be rotated. If you use wildcards (or list multiple files) the scripts are run even if the log is not rotated.

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

How reproducible:
Always

Steps to Reproduce:
1. Create logrotate configuration with pre/post script(s), that uses a wildcard (or multiple file listings) to match file names.
2. Run logrotate with the configuration.
  
Actual results:
Pre/Post scripts are executed for ALL files.

Expected results:
Pre/Post scripts only executed on files that are rotated.

Additional info:
Example:

/tmp/logs/test*.log {
    rotate 2
    daily
    size=4k
    copytruncate
    missingok
    compress
    nosharedscripts
    prerotate
        echo $1
    endscript
    postrotate
        echo $1
    endscript
}

/tmp/logs contains 4 files:
test1.log = 2K
test2.log = 3K
test3.log = 4K
test4.log = 5K

Executing `logrotate test.cfg`, pre and post scripts will be run for ALL test*.log, not just test3 and test4.

Comment 1 Jan Kaluža 2013-04-09 11:24:15 UTC
I think this is bug in logrotate, I have fixed it upstream in this commit:

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

However, I don't presume to fix this in Fedora 17. I will probably fix it in F19.

Comment 2 Fedora Update System 2013-04-30 09:18:00 UTC
logrotate-3.8.4-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/logrotate-3.8.4-1.fc19

Comment 3 Fedora Update System 2013-04-30 19:57:55 UTC
Package logrotate-3.8.4-1.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing logrotate-3.8.4-1.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-7029/logrotate-3.8.4-1.fc19
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2013-05-22 03:09:44 UTC
logrotate-3.8.4-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.


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