Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Member
    Join Date
    Sep 2004
    Posts
    521

    Exclamation 6GB error_log file not rotating!!!

    I´m having a problem with apache error_log file at /usr/local/apache/logs/
    I have deleted and created the file on monday and today is 6.3gb again, seems that is not rotating the logs daily.
    I´ve 404.shtml files in all the accounts

    -rw-r--r-- 1 root root 6.3G Jun 4 14:02 error_log

    any help?

  2. #2
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    10,718
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by bsasninja View Post
    I´m having a problem with apache error_log file at /usr/local/apache/logs/
    I have deleted and created the file on monday and today is 6.3gb again, seems that is not rotating the logs daily.
    I´ve 404.shtml files in all the accounts

    -rw-r--r-- 1 root root 6.3G Jun 4 14:02 error_log

    any help?
    In WHM -> Service Configuration -> Apache Configuration -> Log Rotation try checking the box for "error_log" then clicking save. Note, you may want to also log rotate the rest of the logs on that page.

    Unlike user's HTTP logs, these logs will be rotated once they reach 300 MB in size.

  3. #3
    Member
    Join Date
    Mar 2004
    Posts
    815

    Default

    cPanelDavidG, what about the error_log files that are located within the individual hosted accounts? I just found one error_log file in someone's account that was over 600,000 lines deep! Anything we can do to keep these from eating up web space, that is, without switching this feature off entirely in php.ini?

  4. #4
    Member
    Join Date
    Sep 2004
    Posts
    887

    Default

    Quote Originally Posted by jols View Post
    cPanelDavidG, what about the error_log files that are located within the individual hosted accounts? I just found one error_log file in someone's account that was over 600,000 lines deep! Anything we can do to keep these from eating up web space, that is, without switching this feature off entirely in php.ini?
    If your customer has error_log files that are huge in their own directories, let them reach quota and ask you why their account doesn't work - then you can tell them have have obvious broken PHP scripts generating copious amounts of errors.

    This si really your customer's problem and not yours directly - and you should contact your customer and tell them to either fix whatever is broken and generating the huge files or tell them to go elsewhere.... or just delete the error logs yourself once in a while.

    Mike

  5. #5
    Member
    Join Date
    Mar 2004
    Posts
    815

    Default

    But I am sure, as you probably know there are scripting errors which have no real impact on their scripts or anything else.

    True, such errors are due to poor coding, etc. but in our view, the last thing we need are accounts failing due to "unknown" reasons. (from the customer's point of view)

    And, ANYTHING to reduce support calls is a plus.

    So I take it then, that it is up to us to come up with a script that regularly looks at the size of the error_log files and rotates them when they get too large?

  6. #6
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    Default

    We have a cronjob that sweeps error_logs from all user accounts regularly
    and checks the size before deletion and the number of times it has to sweep
    that particular user and above a certain threshold, it sends us an email to
    go check out the user's account.

    Regarding Mr. 6 GB though, it would seem you have a major problem because
    there is no way the default log for the server should be growing that fast
    unless there is something going on that there shouldn't be.

  7. #7
    Member
    Join Date
    Mar 2004
    Posts
    815

    Default

    Spiral, sounds like just what the doctor ordered.

    Care to post the script that's run by your cron? Last time I tried to set up a shell script to do something like this it caused CPU overloads. I'm really not very good at this kind of thing.

  8. #8
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    Default

    Quote Originally Posted by jols View Post
    Spiral, sounds like just what the doctor ordered.

    Care to post the script that's run by your cron? Last time I tried to set up a shell script to do something like this it caused CPU overloads. I'm really not very good at this kind of thing.
    The following is not what we use ...

    However, someone in another thread asked almost an identical question about error_logs literally
    just a couple of minutes ago and I wrote them a quick script to locate and archive the error_log files so
    here is a variation of the script I just posted in the other thread just a minute ago except rewritten
    to be more used as a cronjob and may be useful to what you are doing as well and should be easily
    modified to add whatever additional functionality you need:
    Code:
    #!/bin/bash
    IFS="$"
    
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
            . ~/.bashrc
    fi
    
    # User specific environment and startup programs
    
    PATH=$PATH:$HOME/bin:/usr/mbin:.
    
    export PATH
    unset USERNAME
    
    TLOG="/tmp/tmp_error_search.$$"
    ELOG="/var/log/client_error_logs.log
    
    # Reset temporary work file if exists
    if [ -e ${TLOG} ]; then
       rm -f ${TLOG}
       /bin/touch ${TLOG}
       /bin/chmod 600 ${TLOG}
    fi
    
    cd /home   #Nice starting point
    
    ls /var/cpanel/users | while read CPLN; do
        echo "$(date) I will now search ${CPLN}'s account for PHP error_log files ..." >> ${ELOG}
        find /home/${CPLN}/public_html -type f -name 'error_log' > ${TLOG}
    done
    
    if [ -e ${TLOG} ]; then
      echo "$(date) I have built my list of error_log files and am now archiving those files ..."  >> ${ELOG}
      cat ${TLOG} | while read MLINE; do
         if [ -e ${MLINE}.bz2 ]; then
            rm -f ${MLINE}.bz2 
            echo "$(date) Removed old archive ${MLINE}.bz2 from hard drive ..."  >> ${ELOG}
         fi
         echo "$(date) Compressing ${MLINE} into new bzip2 archive ..." >> ${ELOG}
         bzip2 -9 "${MLINE}" > /dev/null 2>&1
      done
      rm -f ${TLOG}
    fi
    Last edited by Spiral; 07-11-2009 at 05:44 PM.

  9. #9
    Member
    Join Date
    Mar 2004
    Posts
    815

    Default

    Cool. Thanks very much.

Similar Threads & Tags
Similar threads

  1. Whats this in error_log? ( Usage: file [-bciknsvzL] [-f namefile] )
    By konrath in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 05-05-2010, 10:12 PM
  2. error_log File
    By cancer10 in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 05-13-2008, 01:33 AM
  3. error_log file in every directory?
    By nurseryboy in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 12-13-2006, 12:38 PM
  4. Why isn't rotatelog used for rotating the access_log and error_log files?
    By anup123 in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 11-30-2004, 03:11 PM
  5. is this normal in the error_log file ?
    By silvernetuk in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 12-11-2002, 03:31 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube