Bug 753361 - logrotate script will compress log while possibly being written to
Summary: logrotate script will compress log while possibly being written to
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: rsyslog
Version: 16
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tomas Heinrich
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-11-12 00:48 UTC by JW
Modified: 2016-09-20 04:50 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-11-12 01:32:22 UTC
Type: ---


Attachments (Terms of Use)

Description JW 2011-11-12 00:48:31 UTC
Description of problem:
The /etc/logrotate.d/syslog script has an error which may result in a log file being compressed while still open and being written to.  The file should contain a 'delaycompress' line to prevent this from happening.

You have to carefully read the logrotate manual to understand the order in which logrotate does things. Normally it is: rotate A, postrotate, compress A, rotate B, postrotate, compress B, ....  But when sharedscripts is in effect the order is: rotate A, compress A, rotate B, compress B, ..., postrotate.

Therefore without 'delaycompress' the logs being compressed will still be opened by the application and possibly will be written to while they are being compressed!

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

How reproducible:
Always

Steps to Reproduce:
1. Quicker to read the logrotate manual and understand why the fault exists rather than undertake the complex series of steps it would require to reproduce.
  
Actual results:


Expected results:


Additional info:
The /etc/logrotate.d/syslog config file is also incorrectly named - it should be named rsyslog to match the remainder of the module (eg rsyslog.conf, init.d/rsyslog, rsyslog.d, rsyslogd.8.gz etc).  That bug was reported many moons ago but it looks like everything has reverted back to a wrongly named syslog file again (if it was ever fixed).

Comment 1 JW 2011-11-12 01:32:22 UTC
Closing because not actually a bug. The documentation is misleading and has fooled others, viz: http://stackoverflow.com/questions/7271945/logrotate-compress-files-after-the-postrotate-script

In actual fact when sharedscripts is in effect the order is: rotate A, rotate B, ..., postrotate, compress A, compress B, ...


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