From owner-freebsd-questions@FreeBSD.ORG Mon Mar 5 19:13:59 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 AE21016A402 for ; Mon, 5 Mar 2007 19:13:59 +0000 (UTC) (envelope-from peter@placidpublishing.net) Received: from mail.placidpublishing.net (placidpublishing.net [72.232.50.130]) by mx1.freebsd.org (Postfix) with ESMTP id 8BD4213C481 for ; Mon, 5 Mar 2007 19:13:59 +0000 (UTC) (envelope-from peter@placidpublishing.net) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.placidpublishing.net (Postfix) with ESMTP id 2A5495082D; Mon, 5 Mar 2007 13:19:57 -0600 (CST) Received: from mail.placidpublishing.net ([127.0.0.1]) by localhost (mail.placidpublishing.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 49620-01; Mon, 5 Mar 2007 13:19:51 -0600 (CST) Received: from [192.168.1.20] (c-67-175-92-171.hsd1.il.comcast.net [67.175.92.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.placidpublishing.net (Postfix) with ESMTP id 7E8C75082B; Mon, 5 Mar 2007 13:19:51 -0600 (CST) Message-ID: <45EC6BF3.9090606@placidpublishing.net> Date: Mon, 05 Mar 2007 13:13:55 -0600 From: Peter Pluta Organization: Placid Publishing, LLC User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: David Robillard References: <226ae0c60703051056ofb18dffu1ea0b9d48297b0bf@mail.gmail.com> In-Reply-To: <226ae0c60703051056ofb18dffu1ea0b9d48297b0bf@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard Cc: freebsd-questions@freebsd.org Subject: Re: Apache Rotate Logs and Log Rotate. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: peter@placidpublishing.net List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2007 19:13:59 -0000 Thanks, David. I had already configured it like that the first time around after reading up on it a bit. Most articles/tips I have read say to wait 10 minutes or so and then compress the logs with a shell script in order to be sure Apache finished logging to the files. Another thing, just to be sure. If I had 30 vhosts on my server and each had logs in their home directory, I would still use newsyslog to rotate and delete them, correct? I assume one needs tons of disk space to do that if the sites are rather large. David Robillard wrote: > 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