Use cronolog to Rotate Your Web Server Log Files. The cronolog program reads log messages from its input and writes them to a set of output files, the names of which are constructed using template and the current date and time. The template uses the same format as the UNIX date command (which are the same as the standard C strftime library function).
To install cronolog, connect to your Virtual Private Server via SSH or Telnet and run this command:
% vinstall cronolog
cronolog is intended to be used in your Web Server Configuration File (~/www/conf/httpd.conf) to split the access log file, or other log files, into daily or monthly log files, like in the following example.
TransferLog "|/usr/local/cronolog/cronolog /www/logs/%Y/%m/%d/access.log" ErrorLog "|/usr/local/cronolog/cronolog /www/logs/%Y/%m/%d/errors.log"
The sample configuration directives above instruct Apache to pipe its access and error log messages into separate copies of cronolog, which would create new log files each day in a directory hierarchy structured by date, so that on 31 December 2003 (for example) messages would be written to the following files.
~/www/logs/2003/12/31/access.log~/www/logs/2003/12/31/errors.log
After midnight the following filenames would be written, with the directories 2004, 2004/01 and 2004/01/01 being created if they did not already exist.
~/www/logs/2004/01/01/access.log~/www/logs/2004/01/01/errors.log