Recently i needed to do some housekeeping on my VPS servers, and in my earlier post CPanel Find /Delete all error log files i was mentioning how to find all error log files on a path (in this case, / ).
Now i changed some of this command in order to achieve the following.
Display the size of each error_log file on the cpanel server
Sort the error_log files by size.
Most of the times, there is a specific script/account misbehaving, so the error_log file keeps on increasin it’s size. This command helps you find the biggest ones by size.
find / -name error_log -type f -exec du -sh {} \; | sort -n
You can as well only display the 10 biggest of those error longs, for a quick inquiry on which ones tend to accumulate.
Want to delete them all?
find /home/ -type f -name error_log -delete
ACHTUNG!!! A good admin always reads the error_logs and then decides if they require deletion.