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.

error_log in each folder

Discussion in 'General Discussion' started by thewebhosting, Dec 18, 2008.

  1. thewebhosting

    thewebhosting Well-Known Member

    Joined:
    May 9, 2008
    Messages:
    1,201
    Likes Received:
    1
    Trophy Points:
    38
    Hi,

    I have recently noticed that each folder of all the domains has error_log file. I know it stores the PHP error in it but it is also using large amount of disk space on the server. Is it possible to stop recording PHP error in each folder of the domains?

    I have cPanel 11.24.4-R32443 - WHM 11.24.2.

    Thanks,
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Generally, if an error_log file is so large that one has to worry about the disk consumption implications of the file, it is a good idea to determine the cause of the issue being logged and take corrective action.
     
  3. chuza

    chuza Well-Known Member

    Joined:
    Jul 4, 2008
    Messages:
    47
    Likes Received:
    0
    Trophy Points:
    6
    custom error_log ?

    Well, I believe we can have a custom error_log for a domain by overriding the default ErrorLog directive in httpd.conf file by writing

    ErrorLog /path/to/error_log

    in a VirtualHost. I believe cPanel creates httpd.conf file by using files in /var/cpanel/userdata/username/* files but when I tried to enter the line in a domain's file, httpd.conf was messed up. How to create a permanent local error_log file for a cPanel account/domain ?
     
  4. thewebhosting

    thewebhosting Well-Known Member

    Joined:
    May 9, 2008
    Messages:
    1,201
    Likes Received:
    1
    Trophy Points:
    38
    Yes, I understand it is important it correct the errors. But I do not want error_log file in each folder of all the domains on the server. Can I disable it by making any change so that the log can be written in one file (/usr/local/apache/logs/error_log) ?

    Thanks,
     
  5. verdon

    verdon Well-Known Member

    Joined:
    Nov 1, 2003
    Messages:
    836
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Northern Ontario, Canada
    cPanel Access Level:
    Root Administrator
    I may be wrong, but I don't think you can if you are using suphp. One thing you might do to really reduce the amount of stuff being written to these logs is to tweak your php.ini file so it is not logging so many events.

    For instance, if you have...
    error_reporting = E_ALL

    ... you're going to get a lot of warnings and notices in your log that aren't all that important unless you are de-bugging a script.

    If you have...
    error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR

    ... you're only going to get fatal errors logged ( a LOT less)

    For that matter, you could turn logging of php errors/warnings/notices off altogether in your php.ini file but that makes debugging and troubleshooting pretty hard.
     
  6. dolphyn

    dolphyn Well-Known Member

    Joined:
    Nov 27, 2001
    Messages:
    64
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    If you're running SuPHP, place a custom php.ini file in the user's public_html directory with the desired error_logs directive, and make sure the user has permission to write to that file.
    Yes, this does exactly that: error_logs = "" :D
     
  7. sneader

    sneader Well-Known Member

    Joined:
    Aug 21, 2003
    Messages:
    1,126
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    La Crosse, WI
    cPanel Access Level:
    Root Administrator
    What folder is this?

    I'm actually trying to find where each domain's error log is stored!

    - Scott
     
  8. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    For PHP scripts, you will typically find the generated error_log file in the same directory as the PHP script that generated the runtime errors.
     
  9. sneader

    sneader Well-Known Member

    Joined:
    Aug 21, 2003
    Messages:
    1,126
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    La Crosse, WI
    cPanel Access Level:
    Root Administrator
    Whoops, I might be in the wrong thread. :)

    I was looking for where the customer's logs are stored for things like missing files (404), forbidden access, etc. Not for PHP runtime errors (although that is good to know)

    - Scott
     
  10. dolphyn

    dolphyn Well-Known Member

    Joined:
    Nov 27, 2001
    Messages:
    64
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    By default, /usr/local/apache/logs/error_log ... and the PHP errors might be in there as well, depending on your configuration.
     
  11. sneader

    sneader Well-Known Member

    Joined:
    Aug 21, 2003
    Messages:
    1,126
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    La Crosse, WI
    cPanel Access Level:
    Root Administrator
    OK, that is where I normally go... but since the customer has an "error log" icon in cPanel, I was thinking they had their own logs also. Sounds like cPanel must parse the current error_log each time the customer uses that icon, and delivers only the stuff that matches their username or something.

    Thanks!

    - Scott
     
  12. Sir William

    Sir William Member

    Joined:
    Jul 24, 2006
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    I recently did a PHP/Apache rebuild and forgot a setting which caused EVERY PHP script to throw errors. This meant that any requested file wrote to the error_log in its respective directory. I finally got sick of them all being there so I did a bit of digging and came up with this:

    find /home -name error_log

    That'll give you a list of all the error_log files on the server.

    If you'd like to delete them all, you can do it this way:

    find /home -name error_log -exec rm -f {} \;

    And, if you want to know how big all those files are, you can do this:

    find /home -name error_log -exec stat -c%s {} \;

    I'm sure some BASH expert could get a total of all the numbers, but I just copy/pasted into Excel and did it that way. It was around 25MB. Not a ton, but wasted space nonetheless.

    Hope this helps somebody!
     
Loading...

Share This Page