newsyslog is used by FreeBSD to rotate log files, it can rotate any log file including that of apache.
newsyslog runs every one hour by cron.
You can find following entry in /etc/crontab
/# Rotate log files every hour, if necessary.
0 * * * * root newsyslog
You can rotate a log file by adding it to /etc/newsyslog.conf
A log file can be rotated by size of log file or by time.
Adding following to /etc/newsyslog.conf will rotate your apachelog file at midnight.
/var/log/httpd/*.log 644 4 * @T00 B /var/run/httpd.pid 30
Where
/var/log/httpd/*.log is path to apache log file.
/var/run/httpd.pid is apache pid file, can find from httpd.conf
@T00 means rotate log at midnight
To find more about newsyslog, try
man newsyslog
man newsyslog.conf
newsyslog — maintain system log files to manageable sizes
SYNOPSIS
newsyslog [-CFnrsv] [-R tagname] [-a directory] [-f config_file]
[file …]
DESCRIPTION
The newsyslog utility should be scheduled to run periodically by cron(8).
When it is executed it archives log files if necessary. If a log file is
determined to require archiving, newsyslog rearranges the files so that
“logfile” is empty, “logfile.0” has the last period’s logs in it,
“logfile.1” has the next to last period’s logs in it, and so on, up to
a user-specified number of archived logs. Optionally the archived logs
can be compressed to save space.
A log can be archived for three reasons:
1. It is larger than the configured size (in kilobytes).
2. A configured number of hours have elapsed since the log was
last archived.
3. This is the specific configured hour for rotation of the log.
The granularity of newsyslog is dependent on how often it is scheduled to
run by cron(8). Since the program is quite fast, it may be scheduled to
run every hour without any ill effects, and mode three (above) assumes
that this is so.
When starting up, newsyslog reads in a configuration file to determine
which logs may potentially be archived. By default, this configuration
file is /etc/newsyslog.conf. Each line of the file contains information
about a particular log file that should be handled by newsyslog. Each
line has five mandatory fields and four optional fields, with whitespace
separating each field. Blank lines or lines beginning with “#” are
ignored. If “#” is placed in the middle of the line, “#” character
and the rest of the line after it is ignored. To prevent special mean-
ing, the “#” may be escaped with “”, in this case preceding “” is
removed and “#” treated as ordinary character. The fields of the con-
figuration file are as follows: