The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

suphp_log -- Need solution for quick fix

Discussion in 'General Discussion' started by buckshot101, May 5, 2009.

  1. buckshot101

    buckshot101 Member

    Joined:
    May 12, 2007
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    SInce March, suphp_log has reached its limit 3 times already.

    Without having to contact my dedicated server managed support and waiting hours for the the problem to be fixed, how can I fix the suphp_log file myself via root (putty) or winscp to limit the php downtime and unhappy customers.

    Need command info on how to either rename or delete it.

    Thank You.
     
  2. maever

    maever Active Member

    Joined:
    Sep 26, 2005
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Would you care to further elaborate your question ?

    What happens when the suphp log becomes "full" does the apache server go offline?
     
  3. sohmi

    sohmi Member

    Joined:
    Sep 11, 2008
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    When the suphp_log becomes full (2G) you get an :

    Internal server error

    in the sites that need write in it. This has happened to me today :P

    To avoid this you have to configure the suphp_log file in de logrotate.
     
  4. JPC-Rizwan

    JPC-Rizwan Registered

    Joined:
    Feb 23, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    You can enable rotation for suphp and other apache logs from below link in WHM gui :

    WHM >> Service Configuration >> Apache Configuration

    -- Apache Log Rotation Configuration
     
  5. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,383
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Where is the suphp.log file located?

    You can just use a command line of:

    Code:
    >/var/log/suphp.log
    to empty out the file. This keeps the log file at the same inode, and doesn't require an Apache restart. Just replace /var/log/suphp.log with the correct, full path of the suphp.log file.
     
  6. Misiek

    Misiek Well-Known Member

    Joined:
    Feb 23, 2004
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    6
    Hello,
    The best way ist to change in suphp.conf log_level from info to warn, you will loose nothing ant the log will be small, very small
     
  7. hm2k

    hm2k Well-Known Member

    Joined:
    Jul 19, 2005
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    6
    I too have experienced this issue.

    Removing the log file and enabling apache log rotation seems to have solved the issue for now.

    Is there any reason why this isn't enabled by default?
     
  8. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    I don't know who you got managing your server that it takes "hours" but where I am at, and we provide server management services, it would be extremely rare and unusual for things to take that long unless you were talking some major catastrophic emergency requiring a complete server rebuild or something along those lines. For simple things like what you just mentioned, we'd probably notice before you do! ;)

    Your SuPHP log is actually located in the "/usr/local/apache/log" folder
    and you could rename, archive, or delete it and that will take care of
    things being too large with the log file.

    You could use Cpanel log rotation as previously mentioned and this will help but doesn't roll until the maximum line typically and at this point, your server performance is already impacted before the sites actually die. However, there are better solutions ...

    Drop the following in your /etc/cron.daily folder and it'll roll your suphp log file daily and keep a full week's worth of archives:
    Code:
    #!/bin/bash
    IFS="$"
    typeset -i NLOG=0
    
    cd /usr/local/apache/logs
    
    ## Remove last log in sequence
    if [ -f ./suphp_log.7.bz2 ]; then
      rm -f ./suphp_log.7.bz2
    fi
    
    ## Remove temporary working file
    if [ -f ./suphp_log.1 ]; then
      rm -f ./suphp_log.1
    fi
    
    ## Age remaining logs
    for OLOG in 6 5 4 3 2 1; do
       NLOG=${OLOG}+1
       if [ -f ./suphp_log.${OLOG}.bz2 ]; then
          mv -f ./suphp_log.${OLOG}.bz2 ./suphp_log.${NLOG}.bz2
       fi
    done
    
    ## Roll current log file
    cp ./suphp_log ./suphp_log.1
    cat /dev/null > ./suphp_log
    
    ## Compress rolled log file
    /usr/bin/bzip2 ./suphp_log.1
    
    ## END OF SCRIPT
    
    Download to "suphp_log_rotate.cron" or whatever file name you like! ;)

    Set permissions to "700" and drop in /etc/cron.daily folder


    EDIT: If you initial suphp_log file is unusually large, you may want to clear it before running the initial log rotate
     
    #8 Spiral, Sep 27, 2009
    Last edited: Sep 27, 2009
Loading...

Share This Page