Apache Logs – Disk Space Ubuntu Plesk

0
306

One of my servers started groaning early last week and it turned out I had log files accumulating to nearly 1TB. Log rotation was switched on but it still wasn’t ideal.

I solved this by ssh’ing into a root shell and running the following command:

du -a /var | sort -n -r | head -n 10

This lists the directories which are taking up the most space and it showed up the locations of the log files, for me using plesk and ubuntu they were:

/var/www/vhost/domainname.com/statistics/logs

rm *

Removed them but then I went on to stop it writing to the access log. This can be done by deleting all lines which mention access_log in:

/var/www/vhost/domainname.com/conf/httpd.include    (or whatever the file is called, one server had a random number as the filename.

/etc/apache2/httpd.conf

to delete the lines just nano /etc/apache2/httpd.conf    hold down ctrl w and search for access_log then I think it was ctrl k to delete the line. ctrl x writes out and quits. Then finally restart apache

/etc/init.d/apache2 restart

Server log files shouldn’t cause a problem again.

Disk space usage went from 80% to 1% and Ram usage went from 75% to 45%. Faster server = better conversion rate = improved ROI.

LEAVE A REPLY

Please enter your comment!
Please enter your name here