Delete Large Log Files - Operation Not Permitted
In /usr/local/cpanel/logs theer are several very large log files.
error_log
spamd_error_log
tailwatchd_log
I want to delete these and free up a ton of disk space but when I keep getting this message when I try to rm the files...
root@blahblahwoofwoof [/usr/local/cpanel/logs]# rm error_log
rm: remove regular file `error_log'? y
rm: cannot remove `error_log': Operation not permitted
root@blahblahwoofwoof [/usr/local/cpanel/logs]#
How can I purge these files before they grow to consume my entire drive?
-
Hi @PCZero! cPanel has the cPanel Log Rotation (cpanellogd) feature which would do this for you cPanel Log Rotation Configuration - Version 76 Documentation - cPanel Documentation You can set the log rotation size threshold for these as well at WHM>>Server Configuration>>Tweak Settings Using these methods would be the advisable way to automatically remove cPanel specific log data. If you must remove the data on your own you'd need to modify the attributes of the log file as they're set to append only though I really wouldn't advise doing this lsattr /usr/local/cpanel/logs/error_log -----a-------e-- /usr/local/cpanel/logs/error_log
To modify the file attributes you would use chattr and do something like:chattr -a /usr/local/cpanel/logs/error_log
Then to actually clear the log file I wouldn't use rm I would do something like the following:cat /dev/null > error_log
Thanks!0 -
OK I go to the tweak settings and see nothing under the logs tab about limiting, deleting, or controlling the error_log file. 0 -
error_log spamd_error_log tailwatchd_log
You'll note all of these files are listed here: 554370 -
Hi @PCZero It's there under Stats and Logs "Log rotation size threshold" I usually use the search on the right-hand side of the Tweak Settings box to narrow down what I'm looking for. 0 -
Thank you Lauren 0
Please sign in to leave a comment.
Comments
5 comments