Logrotate error.log

Discussion in 'Installation/Configuration' started by Andreas0815, Sep 12, 2010.

  1. Andreas0815

    Andreas0815 New Member

    Hi!

    Logrotate for Websites access.log works fine but error.log doesn't rotate.

    How to change this?

    Thank you!

    EDIT: Found the solution here: Upgrade to 3.0.3 Beta.
     
    Last edited: Sep 12, 2010
  2. Andreas0815

    Andreas0815 New Member

    Well... the error.log rotation still don't work on 3.0.3 beta :(
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    On my server the error.log gets rotated when it exceeds 10 MB in size. Maybe you have commented out the cron_daily.sh cronjob in the root crontab on your server?
     
  4. Andreas0815

    Andreas0815 New Member

    Hi Till,

    the error.log is more than 60MB. I didn't comment anything out and the access.log rotation works fine...
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    I've just tested the rotation of the website error.log by creating a 11 MB error.log file and then running the cron_daily.sh script with the current SVN version and it worked on my test server.
     
  6. Andreas0815

    Andreas0815 New Member

    With 3.0.3 RC it still don't work :(

    Here is my /usr/local/ispconfig/server/cron_daily.sh:
    Code:
    #!/bin/sh
    
    PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin
    
    /usr/bin/php -q /usr/local/ispconfig/server/cron_daily.php
    So nothing is commented out.
    The error.log is in located at /var/www/clients/clientX/webY/log/error.log, like the access.log. For the access.log the rotation works fine, like I wrote.

    What am I doing wrong? :(
     
  7. SamTzu

    SamTzu Member HowtoForge Supporter

    error.log

    You seem to be correct Andreas.
    /usr/local/ispconfig/server/cron_daily.php does not have anything in it for error.log.

    We had to add this in a cron job to handle error logging with one of our Heavy Duty sites.

    00 09 * * 0 /bin/cat /dev/null > /var/www/HEAVY-DUTY-SITE/log/error.log


    The 400M error.log was killing the whole servers network connectivity :)


    And then the phones started ringing in the middle of the night.
    - Sam
     
    Last edited: Oct 29, 2010
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Then you dont run ISPConfig 3.0.3. From cron_daily.php ispconfig 3.0.3 line 222:

    Code:
    // rotate and compress the error.log when it exceeds a size of 10 MB
    	$logfile = escapeshellcmd($rec['document_root'].'/log/error.log');
    	if(is_file($logfile) && filesize($logfile) > 10000000) {
    		exec("gzip -c $logfile > $logfile.1.gz");
    		exec("cat /dev/null > $logfile");
    	}
     
  9. SamTzu

    SamTzu Member HowtoForge Supporter

    You are right. That particular server was older version.
     

Share This Page