This how-to walks users through setting up proper log file rotation for a multil-site Apache installation where the log file are broken out by site. I built all this on my own, but forgot about logfile rotation so now the log files just keep growing and growing. Time to institute a log rotation algorithm.
For the most part when you are working with Unix you will find that the syslog daemon handles how messages are logged in you system, but Apache handles it’s own logs and the details are typically kept in the httpd.conf file.
sudo grep -i 'log' /etc/httpd/conf/httpd.conf /etc/httpd/conf.d/*
# Custom log file locations LogLevel warn ErrorLog /var/www/html/site1.com/log/error.log CustomLog /var/www/html/site1.com/log/access.log combined # Custom log file locations LogLevel warn ErrorLog /var/www/html/site2.com/log/error.log CustomLog /var/www/html/site2.com/log/access.log combined # Custom log file locations LogLevel warn ErrorLog /var/www/html/site3.com/log/error.log CustomLog /var/www/html/site3.com/log/access.log combined
So, grepping gives me a listing of logfile locations for each of the sites and as you can see they are all located in different directories. You probably also noticed that there are logfiles in the con.d directory that I grepped for. A lot of stuff will want to install there, like phpMyAdmin or webalizer or ssl.conf. One other note, some installations will have their config files in an apache2 directory. Continue reading