From owner-freebsd-isp Thu May 20 9:49:38 1999 Delivered-To: freebsd-isp@freebsd.org Received: from host07.rwsystems.net (kasie.rwsystems.net [209.197.192.103]) by hub.freebsd.org (Postfix) with ESMTP id 491C014DF6 for ; Thu, 20 May 1999 09:49:34 -0700 (PDT) (envelope-from jwyatt@RWSystems.net) Received: from kasie.rwsystems.net([209.197.192.103]) (1807 bytes) by host07.rwsystems.net via sendmail with P:esmtp/R:bind_hosts/T:inet_zone_bind_smtp (sender: ) id for ; Thu, 20 May 1999 11:30:21 -0500 (CDT) (Smail-3.2.0.104 1998-Nov-20 #1 built 1998-Dec-24) Date: Thu, 20 May 1999 11:30:21 -0500 (CDT) From: James Wyatt 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. Since you would quietly lose just a few lines once-in-a-while during a low traffic period, how would you *know*? The server I'm most concerned about handles eCommerce for transportation. It has logs of about 40-50MB/day. This looks like a noticable race condition on most platforms. I would like to know why it doesn't happen if it doesn't. Sounds like I have some playing to do some evening. - Jy@ Wyatts law: The difference between theory and practise is larger in practise than in theory. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message