Jan 292009
 

Since the Apache access logs grow with time, I like to rotate them once a month or so (for minor sites that don’t get much traffic). On Debi­an, you use logrotate (I’ve writ­ten about set­ting it up here). On OpenSol­ar­is, you use the logadm com­mand, with the actu­al rota­tion being spe­cified in /etc/logadm.conf. When you look at that file, it warns you not to edit it by hand, which I found mildly amus­ing. Since you can make changes via the logadm com­mand itself, I figured I’d try that out. 

For Apache log files in the usu­al place, /var/apache2/2.2/logs/access_log, read­ing the man pages for logadm gives 

logadm -w apache -p 1m -C 24\ 
-t '/var/apache2/2.2/old_logs/access_log.%Y-%m'\
-a '/usr/apache2/2.2/bin/apachectl graceful'\
/var/apache2/2.2/logs/access_log

Test­ing with logadm -p now apache seems to work just fine. I’ll know more about how reli­able it is in a month.

/* ]]> */