Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Apr 2000 13:50:14 -0800 (PST)
From:      Derrick Baumer <bduk@earthlink.net>
To:        a.genkin@utoronto.ca
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Rotating apache logs (new logs don't appear)
Message-ID:  <200004012150.NAA04182@earthlink.net>
In-Reply-To: <874s9ly5k5.fsf@tea.thpoon.com> (message from Arcady Genkin on 01 Apr 2000 14:39:06 -0500)

next in thread | previous in thread | raw e-mail | index | archive | help

You need to send HUP to the server.

kill -1 `cat /var/run/httpd.pid`

Also, read the online documentation that comes with the apache install
and check out the frequently asked questions area.

> From: Arcady Genkin <a.genkin@utoronto.ca>
> 
> I've set up a cron job to rotate apache access and error logs, but
> suspect that there's a fault with my script.
> 
> It's been more than 36 hours since the last rotation, and the new logs
> just don't appear (and I know that there has been traffic). Here's
> what I came up with for the script:
> ,----
> | #! /bin/sh
> | # Rename current logs to have today's day of week suffix
> | 
> | ACCESS_LOG=/var/log/apache_access_log
> | ERROR_LOG=/var/log/apache_error_log
> | 
> | # set $DAY to day of week
> | DAY=`date | awk '{print $1}'`
> | 
> | ACCESS_LOG_DAY=$ACCESS_LOG.$DAY
> | ERROR_LOG_DAY=$ERROR_LOG.$DAY
> | 
> | if [ -w $ACCESS_LOG ]
> | then
> |   mv $ACCESS_LOG $ACCESS_LOG.tmp
> |   # remove all entries for local access
> |   egrep -v '^192\.168\.[0-9]*\.[0-9]*' $ACCESS_LOG.tmp > $ACCESS_LOG_DAY
> |   rm -f $ACCESS_LOG.tmp
> | fi
> | 
> | if [ -w $ERROR_LOG ]
> | then
> |   mv $ERROR_LOG $ERROR_LOG_DAY
> |   mail -s "Apache errors log for $DAY" < $ERROR_LOG_DAY webmaster 
> | fi
> `----
> 
> I suspect that perhaps apache keeps track of the log file as a file
> descriptor and doesn't check if the file needs to be re-created when
> trying to write to it, but I might be wrong.
> 
> Thanks for any ideas!
> -- 
> Arcady Genkin                                 http://www.thpoon.com
> Nostalgia isn't what it used to be.



-- 
Derrick Baumer - Black Duck Software
        <bduk@earthlink.net>


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200004012150.NAA04182>