Skip site navigation (1)Skip section navigation (2)
Date:      01 Apr 2000 15:41:23 -0500
From:      Lowell Gilbert <lowell@world.std.com>
To:        Arcady Genkin <a.genkin@utoronto.ca>, freebsd-questions@freebsd.org
Subject:   Re: Rotating apache logs (new logs don't appear)
Message-ID:  <rd63dp5pn9o.fsf@world.std.com>
In-Reply-To: Arcady Genkin's message of 01 Apr 2000 14:39:06 -0500
References:  <874s9ly5k5.fsf@tea.thpoon.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Arcady Genkin <a.genkin@utoronto.ca> writes:

> I've set up a cron job to rotate apache access and error logs, but
> suspect that there's a fault with my script.
[...]
> 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.

No, you're exactly right.  You need to tell Apache when you're moving
the files out from under it.  [This is documented in the Apache
manuals, which is where I figured it out from.]

You need to send a SIGHUP to Apache at the right time.  I use
newsyslog(8) for this, with the relevant line being:
/var/log/httpd-access.log               644  4     100  336   Z /var/run/httpd.pid
but if you really need to write your own script, you'll have to use
kill(1) to do so.  For the record, I recommend using newsyslog if you
can.  

Be well.


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?rd63dp5pn9o.fsf>