How to remove Apache logs & errors

Delete all files

Use the following command to remove all the files and directories inside your apache2 log.

You may want to reload it after deleting.

rm -rf /var/log/apache2/*Code language: JavaScript (javascript)

Reload Apache

/etc/init.d/apache2 restart

Logrotate

Ideally you want to install an utility such as Logrotate so it can do it for you. You can set up the intervals, the file size, etc...

Comments

  1. Thanks a lot man. You saved my day, and my Ubuntu. My logs where 13 GB so I removed them but the space wasn’t freed up even the logs folder was absolutely empty. I’ve tried restarting apache, but nothing worked, nothing but the reload command you’ve posted here. Thanks again.

Leave a Reply

Your email address will not be published. Required fields are marked *