From owner-freebsd-questions Sat Apr 1 11:39:17 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mail1.rdc3.on.home.com (mail1.rdc3.on.home.com [24.2.9.40]) by hub.freebsd.org (Postfix) with ESMTP id BA67D37B676 for ; Sat, 1 Apr 2000 11:39:09 -0800 (PST) (envelope-from antipode@thpoon.com) Received: from tea.thpoon.com ([24.114.152.71]) by mail1.rdc3.on.home.com (InterMail v4.01.01.00 201-229-111) with ESMTP id <20000401193906.BGYT22000.mail1.rdc3.on.home.com@tea.thpoon.com> for ; Sat, 1 Apr 2000 11:39:06 -0800 Received: from antipode by tea.thpoon.com with local (Exim 3.12 #1 (Debian)) id 12bTje-0007XA-00 for ; Sat, 01 Apr 2000 14:39:06 -0500 To: freebsd-questions@FreeBSD.ORG Subject: Rotating apache logs (new logs don't appear) X-Face: 0=A/O5-+sE[Tf%X>rYr?Y5LD4,:^'jaJ!4jC&UR*ZrrK2>^`g22Qeb]!:d;}2YJ|Hq"LHdF OX`jWX|AT-WVFQ(TPhFVak)0nt$aEdlOq=1~D,:\z5QlVOrZ2(H,mKg=Xr|'VlHA="r Organization: Wgaf From: Arcady Genkin Date: 01 Apr 2000 14:39:06 -0500 Message-ID: <874s9ly5k5.fsf@tea.thpoon.com> Lines: 42 User-Agent: Gnus/5.0803 (Gnus v5.8.3) XEmacs/21.1 (Bryce Canyon) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I've set up a cron job to rotate apache access and error logs, but suspect that there's a fault with my script. It's been more than 36 hours since the last rotation, and the new logs just don't appear (and I know that there has been traffic). Here's what I came up with for the script: ,---- | #! /bin/sh | # Rename current logs to have today's day of week suffix | | ACCESS_LOG=/var/log/apache_access_log | ERROR_LOG=/var/log/apache_error_log | | # set $DAY to day of week | DAY=`date | awk '{print $1}'` | | ACCESS_LOG_DAY=$ACCESS_LOG.$DAY | ERROR_LOG_DAY=$ERROR_LOG.$DAY | | if [ -w $ACCESS_LOG ] | then | mv $ACCESS_LOG $ACCESS_LOG.tmp | # remove all entries for local access | egrep -v '^192\.168\.[0-9]*\.[0-9]*' $ACCESS_LOG.tmp > $ACCESS_LOG_DAY | rm -f $ACCESS_LOG.tmp | fi | | if [ -w $ERROR_LOG ] | then | mv $ERROR_LOG $ERROR_LOG_DAY | mail -s "Apache errors log for $DAY" < $ERROR_LOG_DAY webmaster | fi `---- I suspect that perhaps apache keeps track of the log file as a file descriptor and doesn't check if the file needs to be re-created when trying to write to it, but I might be wrong. Thanks for any ideas! -- Arcady Genkin http://www.thpoon.com Nostalgia isn't what it used to be. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message