There are other ways to rotate Apache logs, too.  For example, on my FreeBSD
systems, there is something called newsyslog present at the operating system
level.  There is a file named /etc/newsyslog.conf that has the following
lines on my system (I edited the file and added these lines):

# logfilename          [owner:group]    mode count size when  flags
[/pid_file] [sig_num]
/var/log/httpd-access.log               644  10    1000 *     J
/var/run/httpd.pid    30
/var/log/httpd-error.log                644  10    1000 *     J
/var/run/httpd.pid    30

The signal 30 on FreeBSD is SIGUSR1.  SIGUSR1 is what you send to Apache to
close the current log and start a new one, or something like that.  SIGUSR1
is probably a different number on your Linux system.  Anyhow, the entries
above in newsyslog on my system make everything work perfectly.  Logs are
rotated, archived, and removed after there are too many archived logs.

I prefer rotating logs with newsyslog.

Reply via email to