How to avoid Apache server restart when using Logrotate
Stop Apache web server from restart when log files are rotated using Logrotate.
Use the
copytruncate
parameter to prevent Apache HTTP web server from restarting when log files are rotated. Logrotate will copy the log file and then truncate the log file instead of moving the file.
Edit the logrotate configuration for Apache HTTP logs:
$ nano /etc/logrotate.d/httpd
Add the
copytruncate
parameter in the directive:/var/log/apache/*log { ... copytruncate ... }
Save the
/etc/logrotate.d/httpd
file changes.