Apache error_log missing after logrotate

tolouei

Member
May 17, 2008
10
0
51
After logrotate run, file /usr/local/apache/logs/error_log was missing.

I found the problem: When logrotate run, error_log is compressed and moved to folder ./archive but new error_log was not created because logrotate cant restart apache service. Apache only create ou read new file after restart ou graceful command.

Checking the file: /etc/logrotate.d/httpd

I found the problem in line:

/sbin/service httpd reload > /dev/null 2>/dev/null || true

"reload" is not used anymore (im running apache 2.2.6, whm , cpanel all is updated with last stable version)

I solved changing that line to:

/sbin/service httpd graceful > /dev/null 2>/dev/null || true

Is this correct?


Thanks
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,201
363
Hello :)

Thank you for updating this thread with the outcome. Note that LogRotate is a third-party application that is not managed by cPanel. You may want to have the Apache error_log managed by cpanellogd and have it rotated per the option in:

"WHM Home » Service Configuration » Apache Configuration » Log Rotation"

Thank you.
 

tolouei

Member
May 17, 2008
10
0
51
But Im using cpanellogd,

whm + centos 6.5

maybe I need to disable default logrotate from centos:

chmod -x /etc/cron.daily/logwatch

with this, only cpanellogd act. I think in this case system's logrotate act first then cpanellogd
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,201
363
Yes, you may want to consider disabling LogRotate if you want cPanel to manage the Apache error_log rotation.

Thank you.