From owner-freebsd-questions@FreeBSD.ORG Sun Aug 4 10:54:15 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 90109F3E for ; Sun, 4 Aug 2013 10:54:15 +0000 (UTC) (envelope-from frank2@fjl.co.uk) Received: from bs1.fjl.org.uk (bs1.fjl.org.uk [84.45.41.196]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1742524FC for ; Sun, 4 Aug 2013 10:54:14 +0000 (UTC) Received: from [192.168.1.35] (mux.fjl.org.uk [62.3.120.246]) (authenticated bits=0) by bs1.fjl.org.uk (8.14.4/8.14.4) with ESMTP id r74AsAiN049002 (version=TLSv1/SSLv3 cipher=DHE-DSS-CAMELLIA256-SHA bits=256 verify=NO) for ; Sun, 4 Aug 2013 11:54:10 +0100 (BST) (envelope-from frank2@fjl.co.uk) Message-ID: <51FE32D3.3000707@fjl.co.uk> Date: Sun, 04 Aug 2013 11:54:11 +0100 From: Frank Leonhardt User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: freebsd-questions@freebsd.org Subject: Re: Archiving a log file References: <51FD8E19.90403@fjl.co.uk> <37485629-94BD-48EF-B7A7-9ED4C5B9A6E5@olivent.com> In-Reply-To: <37485629-94BD-48EF-B7A7-9ED4C5B9A6E5@olivent.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Aug 2013 10:54:15 -0000 On 04/08/2013 04:04, mikel king wrote: > On Aug 3, 2013, at 7:11 PM, Frank Leonhardt 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.