Archiving a log file

Frank Leonhardt frank2 at fjl.co.uk
Sun Aug 4 10:54:15 UTC 2013


On 04/08/2013 04:04, mikel king wrote:
> On Aug 3, 2013, at 7:11 PM, Frank Leonhardt <freebsd-doc at fjl.co.uk> wrote:
>
>> The answer isn't (AFAIK) newsyslog
>>
> 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.
>

Thanks for looking at it, but I probably shouldn't have picked Apache as 
an example. I thought it would be something people were familiar with. 
The program writing the log is actually called flubnutz and it doesn't 
play nice with newsyslog, reopen handles on a signal or anything else. 
FWIW I've been using newsyslog since 1998 from most regular system 
services and I don't have any problem with it.

(I lied about it being called "flubnutz", before anyone Googles it - but 
it's not an Apache-specific issue, as Apache logs are handled well 
enough with newsyslog except where you're running virtual hosts with 
their own log files, in which case it's a PITA.).

Regards, Frank.



More information about the freebsd-questions mailing list