Tech note FS1443
How can I rotate my Apache log files?
Maximized Software recommends that you configure Apache to rotate its log files. This is very beneficial because it lets FlashStats read only the log files necessary for the date range that you want to analyze. Otherwise, all entries would go into one large log file, and FlashStats would have to read from the start of the file every time you ran a report.
Unfortunately, Apache provides no inherent log rotation functionality. There is a log rotation process in the Apache distribution "support/rotatelogs.c", but it replaces the logging mechanism, and logging to a process is not reliable in versions before Apache 1.3. There is also a freeware logging process called "cronolog" for Apache, but it has the same limitations since it's a logging program. Finally, FlashStats doesn't support the multiple directory structure for old logs which is the default used by cronolog.
Many Apache users have written rotation scripts to be run from cron. Here is a simple csh script that will rotate log files that could be run nightly from cron:
set date = `date +"%y-%m-%d"`
mv access_log access.$date.log
kill -1 `cat httpd.pid`
Simply change the path for the "access_log" you want to rotate and the make sure the location for "httpd.pid" is accurate so that Apache can reset the log files. This could also easily be modified to run weekly or monthly.
More information on resetting log files can be found at the Apache site.
If your Apache installation hosts more than one web site, we recommend logging each web site's logs to a different directory, especially if you start rotating logs. By keeping each web site's logs in a separate directory, you can easily configure FlashStats with multiple user accounts, one for each web site. With multiple FlashStats user accounts you can easily select which set of log files you want to analyze.