29.21. 配置新的/etc/logrotate.d/apache文件

现在 Apache 日志文件位于/chroot/var/log/httpd目录中,而不是/var/log/httpd因此,我们需要修改/etc/logrotate.d/httpd文件以指向新的 chrooted 目录。此外,我们已经使用 mod_ssl 编译了 Apache,因此我们将添加一行,以允许 logrotate 程序轮转ssl_request_logssl_engine_log文件。配置你的/etc/logrotate.d/apache文件,以便每周自动轮转你的日志文件。

创建apache文件,touch/etc/logrotate.d/apache并添加
        /chroot/httpd/var/log/httpd/access_log {
        missingok
        postrotate
        /usr/bin/killall -HUP /chroot/httpd/usr/sbin/httpd
        endscript
        }

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

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

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