1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Error_Log What to do?

Discussion in 'Site & Server Administration' started by Pathan, Dec 5, 2008.

  1. #1
    Hello,

    Today I check few of my websites folder under my web server I found that most of the folders contains the file "error_log" at some folders it is in smaller size but in others its around 200-400 MB in size per file. My question is

    1. Whether its wise to stop creation of that file by Apache? If yes then how to stop it?

    2. Second question is can we stop it for only few websites?

    3. And is that safe to delete error_log file? If yes how to search that file in SSH and how to delete it using one command as it would be really hard to delete one by one from each folder.

    Please help me with this.

    -Regards.
     
    Pathan, Dec 5, 2008 IP
  2. muhabbatain

    muhabbatain Active Member

    Messages:
    195
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #2
    As far as i know some of the php scripts have function to make log file of errors. Simply delete them if they are in public_html/folder

    In Linux server there are two log files located as

    /usr/local/apache/logs/
    /usr/local/apache/domlogs/

    It is safe to delete /usr/local/apache/logs/error_log file by using rm -rf error_log (But its not recomended)

    /usr/local/apache/domlogs/ it makes the log file to each domain by which Awstat generate daily stat.

    Google it to know more. I am new in this stuff :(
     
    muhabbatain, Dec 6, 2008 IP
  3. RRWH

    RRWH Active Member

    Messages:
    821
    Likes Received:
    49
    Best Answers:
    0
    Trophy Points:
    70
    #3
    the error_log fles in each user directories are as a result of php errors from scripts that have run within the directory.

    you can safely delete them, but they will likely re-appear if they are that big.

    What you should do is to read them and determine what the actual error is and fix it. once fixed, delete the log files.

    The easiest way to remove them is using the find function.

    
    cd /home
    
    find . -name error_log
    
    find . - name error_log -exe rm -f {} \;
    
    find . -name error_log
    
    Code (markup):
    the above commands will first find all files and list them, the next one will find all files and remove them, the last will confirm that all the error log files have been deleted.

    *** Caution - you might want experiment with this command by running it from just 1 account first to make sure it suits your needs and verify that it only deletes the error_log files.
     
    RRWH, Dec 7, 2008 IP
    Pathan likes this.
  4. timarcher52

    timarcher52 Peon

    Messages:
    62
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    A better long term solution if on unix would be to use logrotate to rotate the logs weekly, etc, and control where to archive them to.
    Check out the manpage on it, its well documented on how to use. You may not be able to use it if on a shared hosting environment though.
    Here's one link to a manpage on it:
    http://www.rt.com/man/logrotate.8.html
     
    timarcher52, Dec 8, 2008 IP