From owner-freebsd-isp Thu May 20 14: 2:28 1999 Delivered-To: freebsd-isp@freebsd.org Received: from arnold.neland.dk (mail.neland.dk [194.255.12.232]) by hub.freebsd.org (Postfix) with ESMTP id 6C3B414CFE for ; Thu, 20 May 1999 14:02:23 -0700 (PDT) (envelope-from leifn@neland.dk) Received: from localhost (localhost [127.0.0.1]) by arnold.neland.dk (8.9.3/8.9.3) with ESMTP id XAA38359; Thu, 20 May 1999 23:02:40 +0200 (CEST) (envelope-from leifn@neland.dk) Date: Thu, 20 May 1999 23:02:40 +0200 (CEST) From: Leif Neland To: Roger Marquis Cc: freebsd-isp@FreeBSD.ORG Subject: Re: Web Statistics break up program. In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Tue, 18 May 1999, Roger Marquis wrote: > > > This will create an archived logfile (http.site.May_1999) and erase > > > the original without needing to kill -1 the httpd. > > > > > > #!/bin/sh - > > > LOGDIR=/var/log > > > ARCDIR=/var/log/oldlogs > > > DAY=`date | awk '{ OFS="_" ;print $2,$6}' ` > > > for log in $LOGDIR/http* ; do > > > cp $log $ARCDIR/${log}.${DAY} > > > chmod 440 $ARCDIR/${log}.${DAY} > > > cp /dev/null $log > > > done > > > > Egads!! > > That's a pretty vicious race condition there, you'll lose records on busy > > servers. > > In theory perhaps, in reality it doesn't. I've never seen this algorithm > fail, even when used on log files that grow by several megabytes per day. > How do you know? How do you know if you are throwing some lines away which happened between you started copying, and you nulled the logfile? Leif To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message