29.10. Configure the /etc/logrotate.d/apache file

Configure your /etc/logrotate.d/apache file to rotate each week your Apache log files automatically. Create the apache file, touch /etc/logrotate.d/apache and add:


      /var/log/httpd/access_log {
      missingok
      postrotate
      /usr/bin/killall -HUP httpd
      endscript
      }

      /var/log/httpd/error_log {
      missingok
      postrotate
      /usr/bin/killall -HUP httpd
      endscript
      }

      /var/log/httpd/ssl_request_log {
      missingok
      postrotate
      /usr/bin/killall -HUP httpd
      endscript
      }

      /var/log/httpd/ssl_engine_log {
      missingok
      postrotate
      /usr/bin/killall -HUP httpd
      endscript
      }
    

CAution

Lines to automatically rotate the SSL log files named ssl_request_log and ssl_engine_log are included in this file. If you intend to run Apache without SSL support, you must remove the lines related to SSL.