How to search and find big error_log files on server

There is an easy command that can locate large error_log files on the server. This is great if your server is at a critical level and you want to free up space starting with unnecessary error_log files.

You need to log in to the server via SSH connection and run the following command:

find /home/*/public_html/ -type f -iname error_log -size +500M

Note: Replace /home/*/public_html/ with the path to the folder in which you want to search.

A command containing /home/*/public_html/ will search all public_html directories of all users on the cPanel server. It’s great if you’re an admin on a cPanel shared hosting server.

Also, the +500M part of the command specifies that all error_log files larger than 500 MB should be searched. If you need a different value, feel free to edit the command. For example, if you are looking for logs larger than 1 GB, replace +500M with +1G

Also (number 2), the name of the file that is searched for in the command is error_log, so if you want to search for some other file that is big, feel free to replace the name of error_log with the desired file name.

Author, Ivan Blagojević

Engineering Lead at Adriahost. I spend most of my time on Linux operating systems with cPanel/WHM panels.

I help people solve problems and choose the right hosting for their site.

I write here in my spare time.

Time4VPS - VPS hosting in Europe