pavement

Cronolog

From FreeBSDwiki
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.

example:

CustomLog "|/usr/local/sbin/cronolog --symlink=/data/websites/freebsdwiki.net/logs/httpd-access.log  /data/websites/freebsdwiki.net/logs/httpd-access.%Y-%m.log" combined
ErrorLog  "|/usr/local/sbin/cronolog --symlink=/data/websites/freebsdwiki.net/logs/httpd-error.log   /data/websites/freebsdwiki.net/logs/httpd-error.%Y-%m.log"

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