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 1199504

Summary: logrotate deletes /var/log/messages
Product: Red Hat Enterprise Linux 6 Reporter: Bruno Goncalves <bgoncalv>
Component: logrotateAssignee: Jan Kaluža <jkaluza>
Status: CLOSED DUPLICATE QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: medium    
Version: 6.7Keywords: Regression
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-04-02 07:25:01 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:

Description Bruno Goncalves 2015-03-06 14:10:32 UTC
Description of problem:
Forcing the rotation of syslog causes /var/log/messages to be deleted.


Version-Release number of selected component (if applicable):
logrotate-3.7.8-22.el6

How reproducible:
100%

Steps to Reproduce:
1.# ls -allh /var/log/messages
-rw-------. 1 root root 73K Mar  6 08:51 /var/log/messages

2.# logrotate -f /etc/logrotate.d/syslog
#

3.# ls -allh /var/log/messages
-rw-------. 1 root root 162 Mar  6 08:57 /var/log/messages

4.# logrotate -f /etc/logrotate.d/syslog
error: stat of /var/log/cron failed: No such file or directory
error: stat of /var/log/maillog failed: No such file or directory
error: stat of /var/log/secure failed: No such file or directory
error: stat of /var/log/spooler failed: No such file or directory 

5.# ls -allh /var/log/messages
ls: cannot access /var/log/messages: No such file or directory



Additional info:
on logrotate-3.7.8-17.el6 the file is not deleted

# ls -allh /var/log/messages
-rw-------. 1 root root 270K Mar  6 21:47 /var/log/messages


# logrotate -f /etc/logrotate.d/syslog
#

# ls -allh /var/log/messages
-rw-------. 1 root root 153 Mar  6 21:47 /var/log/messages

# logrotate -f /etc/logrotate.d/syslog
error: stat of /var/log/cron failed: No such file or directory
error: stat of /var/log/maillog failed: No such file or directory
error: stat of /var/log/secure failed: No such file or directory
error: stat of /var/log/spooler failed: No such file or directory

# ls -allh /var/log/messages
-rw-------. 1 root root 153 Mar  6 21:47 /var/log/messages

# cat /etc/logrotate.d/syslog
/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
{
    sharedscripts
    postrotate
	/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}

Comment 2 Bruno Goncalves 2015-03-06 14:14:34 UTC
the problem seems to have been inserted on logrotate-3.7.8-21.el6

Comment 3 Jan Kaluža 2015-03-06 15:08:03 UTC
> logrotate -f /etc/logrotate.d/syslog

You should not execute logrotate like that. If you want to force rotation, execute "logrotate -f /etc/logrotate.conf, otherwise the global options set in /etc/logrotate.conf are not loaded and no old logs are kept.

Comment 4 Jan Kaluža 2015-03-06 15:13:35 UTC
Hm, I see, you expect that after rotation, the files should be recreated by postrotate script. I will check it.

Comment 5 Jan Kaluža 2015-04-02 07:25:01 UTC
We have reverted the patch causing that from the current errata. Since this has never been released and we have already the original bug report (Bug 1177970), I'm closing this one as duplicate.

*** This bug has been marked as a duplicate of bug 1177970 ***