From FreeBSDwiki
(Redirected from Apache, rotating logfiles)
Jump to: navigation, search

cronolog is a utility intended to make log rotation with Apache easy. Generally, one invokes cronolog in a piped log Log directive in httpd.conf or one of its includes.


CustomLog "|/usr/local/sbin/cronolog --symlink=/data/websites/  /data/websites/" combined
ErrorLog  "|/usr/local/sbin/cronolog --symlink=/data/websites/   /data/websites/"

This would cause logging to be automatically split in monthly logs in the format httpd-access.YYYY.MM.log and httpd-error.YYYY.MM.log, with symlinks automatically maintained from httpd-access.log and httpd-error.log to the newest of those logfiles. Newsyslog entries and/or cron jobs are not required, cronolog does all the work itself.

You might, of course, wish to consider cooking up a script invoked once per logging period to automatically bzip or gzip old log files.

Personal tools