How to delete all error_log files on cPanel Servers

How to delete all error_log files on cPanel Servers

Last Updated: 1/07/2015

This article applies to the following services:
  • VPS with a cPanel license
  • Dedicated servers with a cPanel license

From the command line, you can find all occurances along with their size by running the following command.


find /home -type f -name error_log -exec du -sh {} \;

It is probably a good idea to make a note of the large ones and investigate why they are growing so large.

To delete all occurances of the error_log file on the servers, you can run the following command:

find /home -type f -name error_log -delete

You can setup a cron job to run this command nightly or weekly.

30 2 * * * /bin/find /home -type f -name error_log -delete

This will run every night at 2:30 am.
  • 7 Users Found This Useful
Was this answer helpful?

Related Articles

How to install Linux Maldat (Linux Malware Scanner)

How to install Linux Maldat (Linux Malware Scanner)Last Updated: 1/07/2015This article applies to...

How to find the file size of folders in a directory via Linux command line

How to find the file size of folders in a directory via Linux command lineLast Updated:...

How to reboot Apache on a cPanel machine from the Linux command line

How to reboot Apache on a cPanel machine from the Linux command lineLast Updated: 1/07/2015This...

How to compress (tar/gzip) an entire directory in Linux (command line)

How to compress (tar/gzip) an entire directory in Linux (command line)Last Updated: 1/24/2105This...

How to export (mysqldump) and import a mysql database via command line

How to export (mysqldump) and import a mysql database via command lineLast Updated: 1/24/2015This...