Skip to main content

Log files exceeding limits

Comments

4 comments

  • Vs Nu
    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
  • osirion
    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
  • GOT
    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
  • cPanelLauren
    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.