Results 1 to 7 of 7

Thread: Log Rotate

  1. #1
    cPanel Partner NOC cPanel Partner NOC Badge acenetryan's Avatar
    Join Date
    Aug 2005
    Posts
    197

    Default Log Rotate

    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. #2
    Member
    Join Date
    Apr 2005
    Posts
    16

    Default

    Quote Originally Posted by rking
    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.
    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. #3
    Member
    Join Date
    Nov 2003
    Posts
    365

    Default

    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. #4
    Member
    Join Date
    Nov 2003
    Posts
    365

    Default

    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. #5
    Member
    Join Date
    Nov 2003
    Posts
    365

    Default



    log still not rotate

    Disk /dev/sda3 (/usr) 100 %

    :O
    --

  6. #6
    Member
    Join Date
    Nov 2003
    Posts
    365

    Default

    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. #7
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,307
    cPanel/WHM Access Level

    Root Administrator

    Default

    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

Similar Threads

  1. How to rotate a custom log?
    By noimad1 in forum cPanel & WHM Discussions
    Replies: 2
    Last Post: 12-30-2006, 12:26 AM
  2. Add file to log rotate
    By verdon in forum cPanel & WHM Discussions
    Replies: 13
    Last Post: 11-24-2006, 09:12 AM
  3. Log Rotate Issue Still There...
    By ghv in forum cPanel & WHM Discussions
    Replies: 10
    Last Post: 10-14-2004, 03:20 PM
  4. log rotate
    By jlimited in forum New User Questions
    Replies: 0
    Last Post: 08-14-2004, 09:57 AM
  5. Rotate accoutn apache log
    By speckados in forum cPanel & WHM Discussions
    Replies: 1
    Last Post: 03-26-2004, 07:29 AM