Jump to content
Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
NukeNick

cPanel find log file, sort them by size and delete

Recommended Posts

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. 

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×