Managing Overgrown Error Logs for Optimal Performance

  • Thursday, 13th March, 2025
  • 20:27pm

We have observed that some hosting accounts contain overgrown error logs (error_log), which can negatively impact website performance and disk usage.

What is error_log and Why Does It Matter?

The error_log file automatically records website errors, PHP warnings, and debugging messages. While useful, if left unchecked, it can grow excessively large, consuming disk space and potentially affecting website functionality. Read how to locate your cPanel and Plesk error logs.

To clear your error_log file without deleting it, simply run the following command in cPanel Terminal:

cat /dev/null > public_html/error_log

This keeps the error_log file intact while removing all of its contents.

Alternative Paths for Different Hosting Setups

  • For a subdomain (e.g., blog.example.com):
    cat /dev/null > public_html/blog/error_log
  • For a subfolder (e.g., example.com/store/):
    cat /dev/null > public_html/store/error_log
  • For a WordPress installation in a subfolder (e.g., example.com/wp/):
    cat /dev/null > public_html/wp/error_log

How To Clear Your cPanel Hosted Application error_log

1. Log into cPanel

You can log in directly to your cPanel and enter your credentials (recommended until you clear the error_log(s). Alternatively, visit your Services

2. Open the Terminal

In cPanel, scroll down to the Advanced section and click on Terminal.

3. Run the Command to Clear error_log

If your website is in the main directory:

cat /dev/null > public_html/error_log

If your website is in a subfolder (adjust accordingly):

cat /dev/null > public_html/subfolder/error_log

4. Verify the Log Has Been Cleared

Run the following command to check the file size:

ls -lh public_html/error_log

If the size is 0 bytes, the log has been successfully cleared.

5. Exit the Terminal & Monitor Future Log Growth

Revisit the log periodically to ensure it does not become excessively large.

If your error_log grows rapidly, you may need to investigate potential script errors in your application.


Regular maintenance of the error_log file ensures optimal performance and storage efficiency for your website. If you have any questions or need assistance, feel free to contact our technical support team.

« Back

Trusted by over 35,000 customers in over 200 countries