From owner-freebsd-isp Thu May 20 8:49:51 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 7E6D114D04 for ; Thu, 20 May 1999 08:49:29 -0700 (PDT) (envelope-from jwyatt@RWSystems.net) Received: from kasie.rwsystems.net([209.197.192.103]) (1647 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 10:42:55 -0500 (CDT) (Smail-3.2.0.104 1998-Nov-20 #1 built 1998-Dec-24) Date: Thu, 20 May 1999 10:42:48 -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 And on several of our servers will miss some events we need in the log. Any entries that fall between the two 'cp' commands get zapped. (btw: It would be better to move the 'chmod' after the second 'cp' to reduce this) These events will be gone forever and may represent billable or auditable content. beware... What is wrong with signalling the server once a day? Also, this makes a $DAY of something like 'May_1999' You might try: DAY=`date +"%d_%b_%Y"` or DAY=`date +"%Y_%m%b_%d"` which produce '20_May_1999' or '1999_05May_20'. I prefer the second as it sorts better in pure 'ls' form. Hope this helps - Jy@ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message