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.

apache logs not rotating

Discussion in 'EasyApache' started by ukagg, Jan 30, 2007.

  1. ukagg

    ukagg Active Member

    Joined:
    Aug 14, 2002
    Messages:
    35
    Likes Received:
    0
    Trophy Points:
    6
    Hi,

    /usr/local/apache/logs/access_log and /usr/local/apache/logs/error_log have grown too large on all my CentOS4.x servers. All other logs (except these 2) are rotating properly.

    I think, this is because there is no file named apache or httpd in /etc/logrotate.d/

    Can someone suggest how to fix it?

    Thanks
    UKA
     
  2. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    here is a copy of the 'apache' file we used in the /etc/logrotate.d folder and works quiet well.
    Code:
    /usr/local/apache/logs/*_log {
    notifempty
    daily
    rotate 1
    missingok
    compress
    postrotate
    /bin/kill -HUP `cat /usr/local/apache/logs/httpd.pid 2>/dev/null` 2> /dev/null || true
    endscript
    }
    
    Mickalo
     
  3. xerophyte

    xerophyte Well-Known Member

    Joined:
    Mar 16, 2003
    Messages:
    216
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Canada
    you might need to use the
    Code:
    rotate 3 
    when you use rotate 1 its will only keep one log archive and above code rotate every day, if you wanna trouble shoot issues with access.log or something you might need few days of logs, so if you are using daily i would recommend to use 3+

    hope that helps
     
  4. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    this was just posted as a sample, may need to be adjusted for their own preferences!

    Mickalo
     
Loading...

Share This Page