From owner-freebsd-questions@FreeBSD.ORG Mon Mar 5 18:57:00 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DB2CF16A401 for ; Mon, 5 Mar 2007 18:57:00 +0000 (UTC) (envelope-from david.robillard@gmail.com) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.231]) by mx1.freebsd.org (Postfix) with ESMTP id 9C6FB13C4A5 for ; Mon, 5 Mar 2007 18:57:00 +0000 (UTC) (envelope-from david.robillard@gmail.com) Received: by nz-out-0506.google.com with SMTP id r28so1914487nza for ; Mon, 05 Mar 2007 10:56:59 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:mime-version:content-type:content-transfer-encoding:content-disposition; b=QogtiftVmgCLgdd/O3A0FT5znAKMwJ4qF6Duy2U1hL8NtBsAbzAsSovapTSPALv/eIwerJyOUcLhdF/ehPFM+2ofhGx62ForZ2/3OMyrNWW1fXJ0MgYdeF3E9JZD7hMS7G8C9kOn4WAdCzGPBxA78Kt9VlCKUqZSx4P/mjzW4Fk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:mime-version:content-type:content-transfer-encoding:content-disposition; b=DHUunYCJonbiYtQiBUcbyf3wFvRdiZlluXLGJ8X68XYgbqgqEoFABS0Ab/44pee9ukSCqY2623nYLGoQlRfogjpy7OgL67szlayTWcUs54cmwmCVebx0OsRLcSceZqNgxTZ94qe0ojS0eY0GnyToczwmXCya5P6i5FCpOs+5TvI= Received: by 10.65.242.10 with SMTP id u10mr10401024qbr.1173121019605; Mon, 05 Mar 2007 10:56:59 -0800 (PST) Received: by 10.64.210.7 with HTTP; Mon, 5 Mar 2007 10:56:59 -0800 (PST) Message-ID: <226ae0c60703051056ofb18dffu1ea0b9d48297b0bf@mail.gmail.com> Date: Mon, 5 Mar 2007 13:56:59 -0500 From: "David Robillard" To: "FreeBSD Questions" MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Cc: Peter Pluta Subject: Re: Apache Rotate Logs and Log Rotate. 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: Mon, 05 Mar 2007 18:57:00 -0000 On 3/3/07, Peter Pluta wrote: >> I see, thanks. Does the shell script you use automatically delete the >> original logs after verbalizer or awstats makes it's own? I imagine the >> ones those programs use are smaller in size? > > No, the shell script does not delete any logs. Log rotation and > compression is the job of newsyslog. Alright, after some more RTFM on Apache logs, here's what your newsyslog.conf(5) configuration should look like. /var/log/httpd/access.log 640 5 1048576 * B /var/run/httpd.pid 30 /var/log/httpd/error.log 640 5 1048576 * B /var/run/httpd.pid 30 Of course, you should taylor this to suit your own needs (like the size, ownership and number logs kept on disk, etc.) But keep the "B" flag for Binary which will prevent newsyslog from adding a line in your logs which says it was rotated. It _may_ confuse some log analyser (depends on your log analyser software). Also make sure to add the "30" at the end of each line. This is the kill(1) number for signal -USR1 which gracefully restarts Apache. Now the reason I removed the "Z" flags, which eliminates compression, is to make sure all of your children httpd processes have enough time to write their logs into the log file. If a request on your site is rather long, them this is the best way to go. Of couse, that means you will need a little bit more disk space. But not that much depending on how much logs you keep (i.e. 5 in the example above). HTH, David -- David Robillard UNIX systems administrator & Oracle DBA CISSP, RHCE & Sun Certified Security Administrator Montreal: +1 514 966 0122