Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Apache rotate log config option is where?



Jc,

--- Jean-Christian Imbeault <jean_christian@example.com> wrote:
> >Log rotation is generally handled by a script called from cron
> >which renames the existing log file, then sends a signal (USR1 for
> >Apache)
> 
> The log rotation script in RH6.2 seems to be called logrotate. I've
> looked  at it's conf file and it sends HUP signals to httpd. 
> Is this a wrong? Would a USR1 be better?

It is better to use USR1, unless the children really need to be
killed because they are misbehaving and need to be cleaned up. 

See the Apache docs for details:
http://httpd.apache.org/docs/stopping.html

Under Unix, SIGHUP is traditionally used to tell a daemon to
reread its config files and reopen its log files. So the RedHat
solution is good in general, but doesn't necessarily apply in
this case. 

> 
> >It sounds like you are having some trouble with outstanding
> >connections, but this is likely unconnected to the log rolling.
> 
> I'm starting to think so too.
> 
> >More likely, the clients are downloading large files over
> >slow links. If the connection has been lost or abandoned,
> >then the httpd's will stick around until they time out.
> 
> Indeed, these are simple HTTP GET requests of large files over slow
> links (400k over a 64k line).
> 
> I'll try putting a long sleep in the logrotate script and hope the
> children die before the time is up ...

This is not quite the same thing. If you are using SIGUSR1, then
the log will stay open until the last child finishes with its work.
So you need the sleep to wait for it to finish. 
If you are using SIGHUP, then it should be killed, even if it is not
done with its work. In that case, it should die relatively quickly,
unless it is waiting on some resource (e.g., the connection to close).
So a long delay is not required. And it probably isn't writing to the
log file anyway.

I would hesitate to hack logrotate, as it may be used for other stuff
(e.g. rolling system logs).

> 
> I don't know what causes this ... the slow links or what. But once in
> a something hangs ... be it the client's fault (which incidentely are
> my own servers), httpd itself, the log rotation script or the 
> script I use to force servers to HTTP GET files .... ugh!

Sounds like poor error handling in the client programs. Are the 
clients in Perl? The error handling in the Perl libnet library has
traditionally been pretty weak. 

The httpd children can also wait around quite a while before
timing out on a bad connection (10 minutes, say). 

Having lots of slow clients can really consume resources on a web
server, as each one requires a httpd for the duration.

> 
> Jc
> 

Jake


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links