Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 67224 - The Logrotate for apache sometimes will not restart apache
The Logrotate for apache sometimes will not restart apache
Product: Red Hat Linux
Classification: Retired
Component: apache (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Joe Orton
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2002-06-21 05:02 EDT by Need Real Name
Modified: 2007-04-18 12:43 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-09-21 06:17:04 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2002-06-21 05:02:43 EDT
The Apache RPM installs its logrotate piece into /etc/logrotate.d/apache

The postrotate command in this file is ...
/bin/kill -HUP `cat /var/run/httpd.pid 2> /dev/null` 2> /dev/null || true

The problem is that Apache sometimes writes its Process ID into /var/run/httpd.pid and
sometimes into /var/run/httpsd.pid.  In the latter case, the server does NOT get restarted
by logrotate and thus, the Apache keeps writing logs into the newly renamed and rotated
access_log.1, etc.

First, this effectively disables the logrotate function as all data still goes into the same file
(based on the inode number that Apache originally opened) and secondly, after 4 weeks,
when the active file gets deleted by logrotate, bad things happen,  the best case scenario
is that logging gets lost and the worst case is file corruption or server crash.

When Apache is used in SSL mode with a valid key, it stores its Process ID in httpsd.pid.
However, on servers that do not run with a secure key or in secure mode, Apache sometimes
writes to httpd.pid and sometimes httpsd.pid.  I have not been able to figure out what the
determining factor is.  I have to start Apache, look in /var/run and see what file Apache is using
and manually change the logrotate config file for apache.  Once done, it seems to work forever
However, this is something that should be automatic.  The easiest fix is to change the
postrotate part of the /etc/logrotate.d/apache file to check which "pid" file exists and then
restart based on that, but the correct fix is to make Apache consistent.

This bug seems to affect all versions of RedHat Linux, up through the current release.
Comment 1 Joe Orton 2004-09-21 06:17:04 EDT
Thanks for the report.  This bug is no longer present in the Apache
httpd 2.0 packages in Red Hat Enterprise Linux and Fedora Core.

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