Log files exceeding limits
Hi Everyone,
I have my 'rotatelogs_size_threshhold_in_megabytes' under tweak settings set to 500MB.
However, I have various customers with error_log files at 1GB,2GB and even 6GB.
1) How do I enforce the error_log file limit at 500MB for all accounts/server wide?
2) Will running the below help me clear the contents of all error_log files bigger than 499MB:
Thanks in advance!
for i in $(find /home -type f -iname error_log -size +499M);do : > $i;done
Thanks in advance!
-
You can create an cron script to remove the error_log file in your server (All cPanels) If you assign 500M For each account,Just imagine if 20 accounts got 500M Fully on error_log so it will eat some amount of Disk You can use the below command to remove the error_log files certain days once. rm -rfv /home/*/error_log rm -rfv /home/*/public_html/error_log
0 -
Thanks for the response vs Nu - but I think something may be getting lost in translation here. I dont want to remove error_log files daily as they hold valuable information. I just want them to be limited to 500MB and want it to trash the old entries in place of the new entries (so that the error_log file never exceeds 500MB). After I fix cPanel to work as per the above (as its supposed to?) - then only will I run my command ([2] above) to clear any files that are above the 500MB limit (I was just making sure the command was correct so that I dont accidentally cause unwanted destruction). 0 -
cPanel does not rotate user error_logs. It doesn't even try. I cannot offhand think of a way to incorporate logrotate into that mix either. Just spitballing here, but you might be able to use something similar to find /home -name error_log -exec truncate --size=500M {} \; I did read that that might increase the size of the file to 500M if its smaller, but did not test, you'll want to play with it. 0 -
You could use logrotate to do this but it wouldn't do it based off of size it would only do it based off of a schedule (daily, weekly, etc.) You can use wildcards as follows for it as well if all of the error_logs are in the same location in each account so /home/*/path/to/log
This can be configured in the section labeled:# system-specific logs may be configured here
at/etc/logrotate.conf
0
Please sign in to leave a comment.
Comments
4 comments