Bug 1467007 - Apache Reloaded twice with logrotate
Summary: Apache Reloaded twice with logrotate
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Appliance
Version: 5.7.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: MVP
: 5.10.0
Assignee: Joe Rafaniello
QA Contact: luke couzens
URL:
Whiteboard:
Depends On:
Blocks: 1511957 1555371 1569113 1569118
TreeView+ depends on / blocked
 
Reported: 2017-07-01 14:36 UTC by Saif Ali
Modified: 2020-08-13 09:32 UTC (History)
6 users (show)

Fixed In Version: 5.10.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1569113 1569118 (view as bug list)
Environment:
Last Closed: 2019-02-11 13:54:10 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Saif Ali 2017-07-01 14:36:46 UTC
Description of problem:
Apache get reloaded twice by logrotate because we have two configuration file under logrotate.d reloading the service (httpd, miq_logs.conf)


Version-Release number of selected component (if applicable):
4.2, and 4.5 

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Saif Ali 2017-07-01 14:40:54 UTC
Can we add /var/log/httpd/*log path to miq_logs.conf[1], and comment out the service reload in httpd [2]. 
[1]
~~~
/var/log/httpd/*log /var/www/miq/vmdb/log/*.log /var/www/miq/vmdb/log/apache/*.log /var/opt/rh/rh-postgresql95/lib/pgsql/data/pg_log/*.log {
  daily
  dateext
  missingok
  rotate 14
  notifempty
  compress
  copytruncate
  prerotate
    source /etc/default/evm; /bin/sh ${APPLIANCE_SOURCE_DIRECTORY}/logrotate_free_space_check.sh $1
  endscript
  lastaction
    /sbin/service httpd reload > /dev/null 2>&1 || true
  endscript
}
~~~
[2]
~~~
/var/log/httpd/*log {
    missingok
    notifempty
    sharedscripts
    delaycompress
    postrotate
   #     /bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true
    endscript
}
~~~

Comment 3 Joe Rafaniello 2018-03-06 23:05:49 UTC
If I wanted to test a different solution, what is the problem that I should recreate to see if the solution fixes it?  I don't know why it was done this way but I also don't understand what the issue is.

Comment 4 Saif Ali 2018-03-26 14:46:32 UTC
Joe, 
The problem apache get reloaded twice to do the same thing and we can avoid that by  updating miq_logs.conf to include apache logs also.

Comment 5 Joe Rafaniello 2018-03-26 15:32:56 UTC
How do I test this? strace?  Is there a problem this causes or just a waste of time reloading apache?

Comment 6 Saif Ali 2018-03-26 15:46:52 UTC
Joe, 
To test this out run the below commands 
1: watch the logs 

tail /var/www/miq/vmdb/log/apache/miq_apache.log -f

1: force httpd logrotate manually 
logrotate -f /etc/logrotate.d/httpd

you should see apache get restarted 

2: force miq logrotate manually 
 
logrotate -f /etc/logrotate.d/miq_logs.conf

Its just waste of time reloading apache

Comment 8 CFME Bot 2018-04-17 07:12:52 UTC
New commit detected on ManageIQ/manageiq-appliance/master:

https://github.com/ManageIQ/manageiq-appliance/commit/21ad0757c828980dba66c8fc7e531520019b7e20
commit 21ad0757c828980dba66c8fc7e531520019b7e20
Author:     Joe Rafaniello <jrafanie>
AuthorDate: Mon Apr 16 14:44:14 2018 -0400
Commit:     Joe Rafaniello <jrafanie>
CommitDate: Mon Apr 16 14:44:14 2018 -0400

    httpd reload is not needed with copytruncate

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1467007

    As far as I can tell, when this was added originally in:
    66b7a339cf1fc6deef9277bcf685a298bb79d4e4

    the httpd reload was copied from the /etc/logrotate.d/httpd script
    provided by the httpd package. The /etc/logrotate.d/httpd script
    does this because the log files are rotated and httpd needs to reopen
    the file descriptors for these logs. Interestingly, this is not required
    if you use the 'copytruncate' option, which gracefully copies, compresses,
    and truncates the logs without messing up any existing file descriptors.
    Therefore, since we originally added this httpd reload in addition to
    the 'copytruncate', we never needed the former.

    See also:
    https://bugzilla.redhat.com/show_bug.cgi?id=MANAGEIQ-13457

 COPY/etc/logrotate.d/miq_logs.conf | 3 -
 1 file changed, 3 deletions(-)

Comment 11 luke couzens 2018-06-20 08:16:14 UTC
Verified in 5.10


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