Hi, Every time my httpd-access.log file is rotated I need to restart Apache, otherwise it won't write into the new httpd-access.log file. Is there a way for Apache (version 2.0.55 on FreeBSD 6.0) to write to the new log file without the need to restart it? I restart it routinely from a cron job, but occasionally Apache fails to restart (or more precisely, if fails to shutdown completely before it is told to come up again). Thank you very much for your help.
On 25/11/2005, at 1:45 PM, Ladislav Bodnar wrote:> Is there a way for Apache (version 2.0.55 on FreeBSD 6.0) to write > to the > new log file without the need to restart it? I restart it routinely > from a > cron job, but occasionally Apache fails to restart (or more > precisely, if > fails to shutdown completely before it is told to come up again).Look at sysutils/cronolog in ports. Apache logs to cronolog via a pipe and cronolog will do rotation for you without needing to restart Apache. Cheers Phil
My very non-orthodox way is to:- 1) copy the entire content of the log file out for storage, renamed according to date. 2) cat /dev/null to the apache logfile On 11/25/05, Philip Murray <pmurray@nevada.net.nz> wrote:> On 25/11/2005, at 1:45 PM, Ladislav Bodnar wrote: > > Is there a way for Apache (version 2.0.55 on FreeBSD 6.0) to write > > to the > > new log file without the need to restart it? I restart it routinely > > from a > > cron job, but occasionally Apache fails to restart (or more > > precisely, if > > fails to shutdown completely before it is told to come up again). > > Look at sysutils/cronolog in ports. Apache logs to cronolog via a > pipe and cronolog will do rotation for you without needing to restart > Apache. > > Cheers > > Phil
Ladislav Bodnar wrote:>Hi, > >Every time my httpd-access.log file is rotated I need to restart Apache, >otherwise it won't write into the new httpd-access.log file. > >Is there a way for Apache (version 2.0.55 on FreeBSD 6.0) to write to the >new log file without the need to restart it? I restart it routinely from a >cron job, but occasionally Apache fails to restart (or more precisely, if >fails to shutdown completely before it is told to come up again). > >Thank you very much for your help. >_______________________________________________ > >Maybe I am missing something here but can't you use rotatelogs? I use it to rotate logs every day with apache2 and I never restart Apache. Mike
On Fri, 25 Nov 2005, Ladislav Bodnar wrote:> Every time my httpd-access.log file is rotated I need to restart Apache, > otherwise it won't write into the new httpd-access.log file.Use apache's logrotate if you never want to stop apache. If you don't mind the restart you can use newsyslog to role the logs - I've never had it fail to keep apache going. -Darren ______________________________________________________________________ Darren Henderson darren@nighttide.net Help fight junk e-mail, visit http://www.cauce.org/
Ladislav Bodnar wrote:>Hi, > >Every time my httpd-access.log file is rotated I need to restart Apache, >otherwise it won't write into the new httpd-access.log file. > >Is there a way for Apache (version 2.0.55 on FreeBSD 6.0) to write to the >new log file without the need to restart it? I restart it routinely from a >cron job, but occasionally Apache fails to restart (or more precisely, if >fails to shutdown completely before it is told to come up again). > > >If you send it kill -USR1 instead of restarting it, it will close and re-open the logfile(s). -- PGP: http://www.pathcom.com/~lwh/lwh@pathcom.com.asc
On Fri, Nov 25, 2005 at 08:45:43AM +0800, Ladislav Bodnar wrote:> Hi, > > Every time my httpd-access.log file is rotated I need to restart Apache, > otherwise it won't write into the new httpd-access.log file.I usually use something like CustomLog "|/usr/local/sbin/rotatelogs /var/log/apache/logname.%Y%m%d%H 3600" combined This will automatically write to a new file every hour. See "man rotatelogs". rotatelogs is part of apache installation afaik. Regards, Holger Kipp alogis AG, Berlin
> Every time my httpd-access.log file is rotated I need to restart > Apache, > otherwise it won't write into the new httpd-access.log file.In /etc/newsyslog.conf: /var/log/httpd-access.log 644 4 100 * J /var/run/httpd.pid 30 /var/log/httpd-error.log 644 4 100 * J /var/run/httpd.pid 30 This will signal apache to do a graceful restart following a log rotation... ~Dan