Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    2

    Default WHM and logrotate - advice, please

    Running WHM 11.24.2 on RHEL.

    I've only recently understood that there are some issues with log rotation on WHM/cPanel systems, and that it might take some customization to make rotation work in a nice way. Which is kind of strange since just about everything else about WHM/cPanel seems to be designed to be handled by anyone who can handle a keyboard and a mouse.

    Yes, I know there are settings in WHM ("Apache Configuration" and "cPanel Log Rotation Configuration") that makes WHM handle rotation for files in
    /usr/local/apache/logs
    /usr/local/cpanel/logs
    But Apache files seem to be rotated only above 300MB?
    Well, I like my files smaller than that and therefore want to use a custom log rotation.

    Additionally, it seems some files are not covered by the above settings - these were mentioned somewhere:
    /var/log/xferlog
    /var/log/chkservd.log
    And what about files in /usr/local/cpanel/logs/cpbackup, do they stick around for ever?

    I've added the below lines to my /etc/logrotate.conf, and would love some input from a WHM guru on their sanity and completeness.

    I've used the "service" binary rather than "kill -HUP", doing a hard restart of pure-ftpd but restarting apache gracefully. Is this the way to do it?

    /var/log/xferlog {
    weekly
    rotate 1
    postrotate
    /sbin/service pure-ftpd restart > /dev/null 2>/dev/null || true
    endscript
    }

    /var/log/chkservd.log {
    weekly
    rotate 1
    }

    /usr/local/cpanel/logs/cpbackup/*.log {
    weekly
    rotate 1
    }

    /usr/local/cpanel/logs/*log {
    weekly
    rotate 1
    }

    /usr/local/apache/logs/*log {
    daily
    rotate 7
    sharedscripts
    postrotate
    /sbin/service httpd graceful > /dev/null 2>/dev/null || true
    endscript
    }
    Last edited by magnusl; 03-25-2009 at 05:57 AM.

  2. #2
    Member nichiyume's Avatar
    Join Date
    Nov 2004
    Location
    Phoenix, Az
    Posts
    18

    Default

    You could just edit /etc/logrotate.d/httpd and change the directory here:

    Code:
    /var/log/httpd/*log {
        missingok
        notifempty
        sharedscripts
        postrotate
            /sbin/service httpd reload > /dev/null 2>/dev/null || true
        endscript
    }
    Or if you already have files there, you can create another file in logroate.d with the other directory you are interested in. Just because logrotate rotates the cpanel logs doesn't mean that the new logs will be written. The daemon could be trying to write to a non-existant file and so they would have to be restarted. Using Main >> Service Configuration >> cPanel Log Rotation Configuration is best for those logs in case the Cpanel daemons need to be restarted.
    --rayrayisforever
    TranceDesign Podcast | Hardcoredreamer Blog | Gallery

Similar Threads & Tags
Similar threads

  1. logrotate -d /etc/logrotate.conf hags
    By asmithjr in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 05-18-2009, 04:43 PM
  2. logrotate
    By dsb1972 in forum New User Questions
    Replies: 0
    Last Post: 07-07-2008, 11:04 PM
  3. logrotate
    By JamesSmith in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 10-16-2003, 11:10 AM
  4. logrotate:
    By bert in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 07-11-2002, 07:48 PM
Tags for this Thread
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube