Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1177970

Summary: logrotate Fails if File is Removed During Rotation Process
Product: Red Hat Enterprise Linux 6 Reporter: Jamie Duncan <jduncan>
Component: logrotateAssignee: Kamil Dudka <kdudka>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: high Docs Contact:
Priority: high    
Version: 6.6CC: bgoncalv, cww, dsirrine, jkaluza, jorton, psklenar, todoleza
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: logrotate-3.7.8-21.el6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1196583 (view as bug list) Environment:
Last Closed: 2017-05-31 19:58:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1196583    
Bug Blocks: 1075802, 1172231, 1269194    

Description Jamie Duncan 2014-12-31 20:46:03 UTC
Description of problem:
logrotate exits prematurely if a log file exists when logrotate is executed but is removed before logrotate has begun rotating that particular file.

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

logrotate 3.7.8

How reproducible:
100% of the time, but requires a large log file / something to make the logrotate process take longer than a 'standard' run.

Steps to Reproduce:
1. have a file that is normally rotated
2. start a logrotate process
3. during processing, remove the file before it is rotated.

Actual results:
logrotate errors out

Expected results:
logrotate should warn / log the condition, but continue processing the remaining files

Additional info:

from a logrotate debug log (anonymized)

$ grep -n myfile.dat data.dat 
5774:considering log /data/dir/myfile.dat
65015:rotating log /data/dir/myfile.dat, log->rotateCount is 14
152016:copying /data/dir/myfile.dat to /data/dir/myfile.dat.2014-12-16-00
152017:error: error opening /data/dir/myfile.dat: No such file or directory
user@host CUS$ grep error data.dat 
error: error opening /data/dir/myfile.dat: No such file or directory
user@host CUS$ wc -l data.dat 
152017 data.dat

Comment 4 Jamie Duncan 2015-01-27 18:56:29 UTC
I can't think of a valid reason for logrotate to totally error out if sharedscripts is enabled, and to not totally error out if it's not.

Is there some logic there that I'm missing?

If so, please let me know so I can better inform the customer.

If there isn't, then I'd like to still have this considered as a bug and have logrotate fail gracefully if an anticipated file is gone whether or not sharedscripts is enabled.

Thanks,

Jamie Duncan

Comment 5 Jan Kaluža 2015-01-29 07:48:52 UTC
(In reply to Jamie Duncan from comment #4)
> I can't think of a valid reason for logrotate to totally error out if
> sharedscripts is enabled, and to not totally error out if it's not.
> 
> Is there some logic there that I'm missing?
> 
> If so, please let me know so I can better inform the customer.
> 
> If there isn't, then I'd like to still have this considered as a bug and
> have logrotate fail gracefully if an anticipated file is gone whether or not
> sharedscripts is enabled.

I think this behaviour is bad and should be fixed. "sharedscripts" should have impact only on postrotate/prerotate script execution. When rotation of single log file fails, it should print an error, but continue with another log no matter if there's "sharedscripts" or not.

However, if you use "sharedscripts" and the postrotate or prerotate script returns an error, no logs should be rotated (That's mentioned in manpage).

I presume it would be acceptable fix for the customer to print an error and do not rotate the missing/removed log, but continue rotating other logs from the log set.

Comment 13 Jan Kaluža 2015-04-02 07:25:01 UTC
*** Bug 1199504 has been marked as a duplicate of this bug. ***

Comment 17 Chris Williams 2017-05-31 19:58:50 UTC
Red Hat Enterprise Linux 6 transitioned to the Production 3 Phase on May 10, 2017.  During the Production 3 Phase, Critical impact Security Advisories (RHSAs) and selected Urgent Priority Bug Fix Advisories (RHBAs) may be released as they become available.

The official life cycle policy can be reviewed here:

http://redhat.com/rhel/lifecycle

This issue does not appear to meet the inclusion criteria for the Production Phase 3 and will be marked as CLOSED/WONTFIX. If this remains a critical requirement, please contact Red Hat Customer Support to request a re-evaluation of the issue, citing a clear business justification.  Red Hat Customer Support can be contacted via the Red Hat Customer Portal at the following URL:

https://access.redhat.com