James Bachini

Apache Logs – Disk Space Ubuntu Plesk

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.


Get The Blockchain Sector Newsletter, binge the YouTube channel and connect with me on Twitter

The Blockchain Sector newsletter goes out a few times a month when there is breaking news or interesting developments to discuss. All the content I produce is free, if you’d like to help please share this content on social media.

Thank you.

James Bachini

Disclaimer: Not a financial advisor, not financial advice. The content I create is to document my journey and for educational and entertainment purposes only. It is not under any circumstances investment advice. I am not an investment or trading professional and am learning myself while still making plenty of mistakes along the way. Any code published is experimental and not production ready to be used for financial transactions. Do your own research and do not play with funds you do not want to lose.


Posted

in

by