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:
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 } ~~~
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.
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.
How do I test this? strace? Is there a problem this causes or just a waste of time reloading apache?
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
https://github.com/ManageIQ/manageiq-appliance/pull/185
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(-)
Verified in 5.10