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.

Log Rotate

Discussion in 'General Discussion' started by acenetryan, Oct 18, 2005.

  1. acenetryan

    acenetryan Well-Known Member
    PartnerNOC

    Joined:
    Aug 21, 2005
    Messages:
    197
    Likes Received:
    1
    Trophy Points:
    18
    In the file :

    pico /etc/logrotate.d/httpd

    The first line refers to /var/log/httpd/ as the path to logs. I have found this on the web and was wondering if anyone has any response as to the validity of the post:

    --------------

    Since the beginning of time, cPanel has had logs that it simply does not rotate properly. Why this has been an ongoing problem that has never been fixed is beyond me, but it CAN be fixed and we'll go through what is needed to accomplish this.

    The most important logs that are missed are the Apache system logs that are located in /usr/local/apache/logs. SSH into your server as root.

    pico /etc/logrotate.d/httpd
    (on some servers this file is called apache)

    The first line should read:

    /usr/local/apache/logs/*log {

    Also you need to change the line that reads:

    /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true

    to:

    /bin/kill -HUP `cat /usr/local/apache/logs/httpd.pid 2>/dev/null` 2> /dev/null || true
    (the above line should all be on ONE LINE!)

    --------------

    Just wanted to get some feedback before I potentially bork my logs.
     
  2. marcadrian

    marcadrian Member

    Joined:
    Apr 7, 2005
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    It doesnt refer to /var/log/httpd?

    It refers to the /usr/local/apache/logs which certainly do NOT rotate themselves... you have to include the log rotation yourself in your config.

    So yes, it is a valid post and I have been using it on all my servers as of late..
     
  3. webstyler

    webstyler Well-Known Member

    Joined:
    Nov 20, 2003
    Messages:
    432
    Likes Received:
    0
    Trophy Points:
    16
    Hi

    My apache log files is not rotated

    So I have modify /etc/logrotate.d/httpd

    /usr/local/apache/logs/*log {
    missingok
    notifempty
    compress
    sharedscripts
    postrotate
    /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
    }

    --

    Is correct ??

    "httpd reload" is ok ?

    I have found different tutorial that say to put this row:
    /bin/kill -HUP `cat /usr/local/apache/logs/httpd.pid 2>/dev/null` 2> /dev/null || true

    ??

    Thanks
     
  4. webstyler

    webstyler Well-Known Member

    Joined:
    Nov 20, 2003
    Messages:
    432
    Likes Received:
    0
    Trophy Points:
    16
    another 2 newbie question:

    1. how can I run logrotate without wait cron ?
    2. I have modify httpd on logrotate.d directory, this file is read and executed automatically or I need to setting anything on other file ?

    Thanks
     
  5. webstyler

    webstyler Well-Known Member

    Joined:
    Nov 20, 2003
    Messages:
    432
    Likes Received:
    0
    Trophy Points:
    16
    :(

    log still not rotate

    Disk /dev/sda3 (/usr) 100 %

    :O
     
  6. webstyler

    webstyler Well-Known Member

    Joined:
    Nov 20, 2003
    Messages:
    432
    Likes Received:
    0
    Trophy Points:
    16
    I have try to lunch
    /usr/sbin/logrotate httpd

    and this work :/

    so think cron don't run "httpd" on /etc/logrotate.d

    why ??
     
  7. 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
    You may want to have our technical analysts take a look at your server if you believe any cPanel-supplied scripts aren't working as they should: http://tickets.cPanel.net/submit
     
Loading...

Share This Page