Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 May 1999 19:59:19 -0700 (PDT)
From:      Roger Marquis <marquis@roble.com>
To:        freebsd-isp@FreeBSD.ORG
Subject:   Re: Web Statistics break up program.
Message-ID:  <Pine.GSO.3.96.990518195705.24618B-100000@roble2.roble.com>
In-Reply-To: <19990518172622.C1539@futuresouth.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> > 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.

--
Roger Marquis
Roble Systems Consulting
http://www.roble.com/



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-isp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.3.96.990518195705.24618B-100000>