Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 May 1999 10:42:48 -0500 (CDT)
From:      James Wyatt <jwyatt@RWSystems.net>
To:        Roger Marquis <marquis@roble.com>
Cc:        freebsd-isp@FreeBSD.ORG
Subject:   Re: Web Statistics break up program.
Message-ID:  <Pine.BSF.4.05.9905201027590.18069-100000@kasie.rwsystems.net>
In-Reply-To: <Pine.GSO.3.96.990517151403.24114A-100000@roble2.roble.com>

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




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