Archiving a log file

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


On Aug 3, 2013, at 7:11 PM, Frank Leonhardt <freebsd-doc at fjl.co.uk> 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:

NAME 
	 rotatelogs - Piped logging program to rotate Apache logs 
SYNOPSIS
	rotatelogs [ -l ] [ -f ] logfile rotationtime|filesizeM [ offset ] 
SUMMARY 
	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. 

Regards,
Mikel King
BSD News Network
http://bsdnews.net
skype: mikel.king
http://twitter.com/mikelking




More information about the freebsd-questions mailing list