From owner-freebsd-questions@FreeBSD.ORG Thu Jul 17 18:56:54 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22BCF1065683 for ; Thu, 17 Jul 2008 18:56:54 +0000 (UTC) (envelope-from dnewman@networktest.com) Received: from mail.networktest.com (mail.networktest.com [216.240.60.134]) by mx1.freebsd.org (Postfix) with ESMTP id 001FE8FC29 for ; Thu, 17 Jul 2008 18:56:53 +0000 (UTC) (envelope-from dnewman@networktest.com) Received: by mail.networktest.com (Postfix, from userid 1002) id C3A6D78C7A; Thu, 17 Jul 2008 11:56:53 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail.networktest.com X-Spam-Level: X-Spam-Status: No, score=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from dhcp130.eng.networktest.com (ns.networktest.com [216.240.60.130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.networktest.com (Postfix) with ESMTPSA id EC38C78C84 for ; Thu, 17 Jul 2008 11:56:51 -0700 (PDT) Message-ID: <487F95F3.1080006@networktest.com> Date: Thu, 17 Jul 2008 11:56:51 -0700 From: David Newman Organization: Network Test Inc. User-Agent: Thunderbird 2.0.0.14 (Macintosh/20080421) MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <487F2525.3030304@lcwords.com> <20080717072023.4b9e1d2f.wmoran@potentialtech.com> <487F2D9B.2010407@lcwords.com> <200807170904.26354.mario.lobo@ipad.com.br> <487F52EE.2050907@infracaninophile.co.uk> In-Reply-To: <487F52EE.2050907@infracaninophile.co.uk> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: log size handling X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jul 2008 18:56:54 -0000 On 7/17/08 7:10 AM, Matthew Seaman wrote: > * Use the rotatelogs program that comes with Apache. In this case, > you replace the logging configuration statements in https.conf > eg. instead of: > > CustomLog "/var/log/httpd-access.log" combine > > you have: > > CustomLog "|/usr/local/sbin/rotatelogs /var/log/httpd-access.log > 86400" > > which will create a new log file every 86400 seconds (= 1 day) and > label each one with the unix time it was created appended to the > name. eg: > > /var/log/httpd-access.log.1216252800 > > That will change files at midnight UTC each day, which is fine > if your server lives in the UK but not quite as convenient if your > server is in Australia. Yes. Apache's rotatelogs is a better choice than newsyslog. Under heavy load, the latter can corrupt Apache logs. rotatelogs also can do changes based on log size, like this: CustomLog "|/usr/local/sbin/rotatelogs/var/log/httpd-access.log 5M" \ combined and if you don't like deciphering Unix epoch time, you can embed times in your log filenames like this: CustomLog "|/usr/local/sbin/rotatelogs \ /var/log/httpd-access.log.%Y-%m-%d-%H_%M_%S 86400" combined (n.b. I added the backslashes in the examples here; you want everything on a single line in your config file.) dn