Apache log rotation

No Comments

One of the easiest things to do to save disk space (and our costs, and ultimately, yours) is to be sure to rotate apache logs. This is very simple to do in Apache and our OpenSolaris VPS servers.

Just yesterday, we had one customer that was had GB of log data:

root@wolf:/home# du -sh */logs/*
  56K	administracionalta/logs/access_log
 898K	administracionalta/logs/error_log
   0K	ascensoresfamtech/logs/access_log
  47K	ascensoresfamtech/logs/error_log
   0K	gusonline/logs/access_log
   0K	gusonline/logs/error_log
 898K	pintoporcelana/logs/access_log
  11K	pintoporcelana/logs/access_log.1270252800
 3.3M	pintoporcelana/logs/error_log
 5.0M	radiosentidos/logs/access_log
 115K	radiosentidos/logs/access_log.1270252800
  14G	radiosentidos/logs/error_log
   0K	sanceferinoweb/logs/access_log
 1.4M	sanceferinoweb/logs/error_log
   0K	teinvito/logs/access_log
  69K	teinvito/logs/error_log
   0K	teinvitotv/logs/access_log
   0K	teinvitotv/logs/error_log
root@wolf:/home# 

We changed httpd.conf file for the CustomLog definition to look like:

CustomLog "|/usr/bin/rotatelogs /var/apache2/2.2/logs/access_log 86400" common

Restart apache, and that should do it! That was simple right? Now, next time use something better than Apache if possible. :)

Be the first to write a comment!