*BSD News Article 74983


Return to BSD News archive

Newsgroups: comp.unix.bsd.freebsd.misc
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!spool.mu.edu!howland.reston.ans.net!agate!info.ucla.edu!newsfeed.internetmci.com!ncar!csn!nntp-xfer-1.csn.net!alisa.org!wjjr
From: wjjr@alisa.org (John J. Rushford)
Subject: Re: How do I delete Apache Log Files
X-Newsreader: TIN [version 1.2 PL2]
Organization: My place on the Front Range.
Message-ID: <DvBszp.58M@alisa.org>
References: <4tj0ji$ooo@adcmail.adc.com>
Date: Mon, 29 Jul 1996 22:26:13 GMT
Lines: 33

Michael A. Dorin (mad@adc.com) wrote:
: I know that this has been posted before, but I have somehow
: lost the information.

: How does one delete apache log files?

: -Mike

I just bought "Running A Perfect WEB SITE with APACHE" ISBN 0-7897-0745-4 and
think that it is an excellent book.  Anyway, Here is a shell script that
basically comes from the book, I've modified it for my system.  I schedule
this script from cron nightly at 23:55.  Hope this is useful to you.
BTW, the book comes with a CDROM and has the latest apache.  I had absolutely
no problem in compiling it with FreeBSD 2.1.0.

regards
John Rushford
wjjr@alisa.org

    #
    # /usr/local/etc/httpd/bin/mvlogs
    #!/bin/sh

    DAY=`/bin/date +%w`
    LOGDIR="/usr/local/etc/httpd/logs"
    
    for f in access_log agent_log error_log referer_log ; do
        /bin/rm $LOGDIR/${f}.$DAY
        /bin/mv $LOGDIR/$f $LOGDIR/${f}.$DAY
    done
    
    kill -HUP `cat $LOGDIR/httpd.pid`