29.10. 配置/etc/logrotate.d/apache文件

配置你的/etc/logrotate.d/apache文件,以便每周自动轮换你的 Apache 日志文件。创建apache文件, touch/etc/logrotate.d/apache并添加

      /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

行以自动轮换名为ssl_request_logssl_engine_logSSL 日志文件。 如果你打算在没有 SSL 支持的情况下运行 Apache,你必须删除与 SSL 相关的行。