Remove old error logs on your server

November 2, 2015 — Leave a comment

If you have a server with a lot of sites on it, error logs can be forgotten about and end up taking up a lot of unnecessary space. Here’s a good way to keep them cleaned up!

First, let’s define what we’re looking for here. We’ll use a cpanel server as an example. By default, you’ll find error_log files in various directories under the account’s public_html directory. Most times these won’t take up too much space unless you have some issue or extra reporting set up.

We can remove these and Apache will re-create them if it needs to.

First, find out if you even need to do this. Let’s run a find command to locate them and see how much space they’re taking up.

You’ll see something like this:

While the first two don’t take up too much room, the 3rd is complaining about something – you’ll want to read through it and see what the issue is. When you’re done though, free up all of the error logs with this command:

You’ll want to do this every now and then to make sure the sites on the server aren’t complaining too much, then take action when you see them growing quickly.




No Comments

Be the first to start the conversation.

Leave a Reply