Archiving a log file

mikel king mikel.king at
Sun Aug 4 03:03:16 UTC 2013

On Aug 3, 2013, at 7:11 PM, Frank Leonhardt <freebsd-doc at> wrote:

> The answer isn't (AFAIK) newsy slog

I did some more digging on the whole log piping thing and apache includes a nifty little application called rotatelogs which lives in /usr/local/sbin/rotatelogs on my system that I built form the ports. From the man page:

	 rotatelogs - Piped logging program to rotate Apache logs 
	rotatelogs [ -l ] [ -f ] logfile rotationtime|filesizeM [ offset ] 
	rotatelogs is a simple program for use in conjunction with Apache's piped logfile feature. It supports rotation based on a time interval or maximum size of the log.

It looks pretty simple to use just create your log format directive like:

	LogFormat "%t \"%r\" %>s \"%{Referer}i\" %b" SpecialFormat

	CustomLog "| /usr/local/sbin/rotatelogs /var/log/httpd-access.log 86400" SpecialFormat

I hope that helps. I know I shall be experimenting with this one tomorrow. 

Mikel King
BSD News Network
skype: mikel.king

More information about the freebsd-questions mailing list