Keeping Apache Logs under Control

by J. Edward Durrett

On Freebsd the utility newsyslog helps keep logs under control. To use
this with Apache24 edit /etc/newsyslog.conf and add:

/var/log/httpd-access.log 644 7 100 @T00 BJG /var/run/ 30

Restart newsyslog:

#service newsyslog restart

For a system with multiple virtual hosts, keep things simple by naming
all the Apache log files starting with httpd- (httpd-host1-access.log,
httpd-host2-access.log, etc). Then, use a wild card in newsyslog:

/var/log/httpd-*.log 644 7 100 @T00 BJG /var/run/ 30

This rotates all log files starting with httpd- and keeps the
newsyslog.conf short and easy to read. Any additional hosts will have
their logs rotated as long as the httpd- naming syntax is maintained.

Copyright (c) 2019, Jason Edward Durrett - All content on this site, unless otherwise noted, is subject to this license.

Please contact me if any errors, such as erroneous / misleading content or missing / incomplete attribution, are found.