On 8 July, 2004, at 22:46 (-0400)
Bill Moran <[EMAIL PROTECTED]> wrote:

> "Graham North" <[EMAIL PROTECTED]> wrote:
> > Hello all:
> >
> > There has to be a simple fix to this problem - I am using newsyslog and cron
> > to rotate my Apache logfiles.    They get rotated and Apache keeps working
> > however after a log rotation takes place Apache will not longer log my
> > accesses.   It does continue to serve pages but I need to do an apachectl
> > restart in order for it to continue logging properly.
> >
> > newsyslog.conf and crontab files are attached for reference.
> You need to restart apache to get it to start logging to a new file.  Luckily,
> newsyslog can do this for you.
> With the default Apache install, Apache will log its PID to a file when it
> starts, just add this filename (/var/run/httpd.pid) to the end of each
> newsyslog entry that rotates an apache file, and newsyslog will automatically
> send a HUP signal to that PID when the log file is rotated
> See the man pages for newsyslog for more detailed info.

Another option is to use the sysutils/cronolog port. Configure it in
httpd.conf, with ErrorLog and CustomLog directives similar to the

ErrorLog "|/usr/local/sbin/cronolog --symlink=/var/log/httpd/error_log 

CustomLog "|/usr/local/sbin/cronolog --symlink=/var/log/httpd/access_log 
/var/log/httpd/access_log_%y%m%d" combined

cronolog will rotate logs automatically each day. From the cronlog man page:

       Before writing a message cronolog checks the time to  see  whether  the
       current  log file is still valid and if not it closes the current file,
       expands the template using the current date and time to generate a  new
       file name, opens the new file (creating missing directories on the path
       of the new log file as needed  unless  the  program  is  compiled  with
       -DDONT_CREATE_SUBDIRS)  and  calculates  the time at which the new file
       will become invalid.

See the man page for further details.

I've been using it for awhile on my public web server. Seems to work just fine.


Brian Clapper, http://www.clapper.org/bmc/
Scott's first Law: No matter what goes wrong, it will probably look right.

[EMAIL PROTECTED] mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to