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

Securing and Optimizing Linux: RedHat Edition -A Hands on Guide
Prev | Chapter 29. Software -Network Server, web/Apache | Next

# 29.21. Configure the new `/etc/logrotate.d/apache` file

Now Apache logs files residing in the `/chroot/var/log/httpd` directory instead of `/var/log/httpd` and for this reason we need to modify the `/etc/logrotate.d/httpd` file to point to the new chrooted directory. Also, we've compiled Apache with mod_ssl, so we'll add one more line to permit the logrotate program to rotate the `ssl_request_log` and `ssl_engine_log` files. Configure your `/etc/logrotate.d/apache` file to rotate your log files each week automatically.

Create the `apache` file, touch `/etc/logrotate.d/apache` and add:

            /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
            }

Prev | Home | Next
Test the new chrooted jail | Up | Optimizing Apache