Installation was easy:
yum install cronolog
Then a quick change to my httpd.conf file:
ErrorLog "|/usr/sbin/cronolog /path/to/error_log_%Y-%m"
CustomLog "|/usr/sbin/cronolog /path/to/access_log_%Y-%m" combined
The %Y will give you a four-digit year, %m will give you a two-digit month. Restart Apache, make sure everything works. Then edit your awstats.*.conf file:
LogFile="/path/to/access_log_%YYYY-0-%MM-0"
Slightly different date syntax, but you get most of it: %YYYY is a four-digit year, %MM is a two-digit month. AWStats also includes a -n after the date code, which refers to the number of hours back to go. %YYYY-2 would mean whatever the year was two hours ago.
Guess what? That's it! If you're like me, and you want small log files sorted by date, this is the way to go. Apache doesn't do it by itself, and in retrospect it's probably pretty trivial to set something up, but cronolog is already there, and setting it up is even more trivial. AWStats already has support for date-stamped files built-in, so it's just as easy to set it up.
Have fun with that one.
Another way to do this:
ReplyDeleteErrorLog "|/usr/sbin/cronolog -S /path/to/error_log /path/to/%Y/%m/%d-error_log"
CustomLog "|/usr/sbin/cronolog -S /path/to/access_log /path/to/%Y/%m/%d-access_log" Combined
This will setup a symlink called access_log and error_log which each points to the most recent logfile and gets rotated automatically.