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.

Logrotate Not Compressing the Logs

Discussion in 'General Discussion' started by lloyd_tennison, Jan 10, 2006.

  1. lloyd_tennison

    lloyd_tennison Well-Known Member

    Joined:
    Mar 12, 2004
    Messages:
    698
    Likes Received:
    1
    Trophy Points:
    18
    Yet I have:

    Code:
    # see "man logrotate" for details
    # rotate log files weekly
    weekly
    
    # keep 4 weeks worth of backlogs
    rotate 4
    
    # create new (empty) log files after rotating old ones
    create
    
    # uncomment this if you want your log files compressed
    compress
    as the start of my logrotate.conf. The logs rotate - just do not compress.

    Thoughts?

    Correction: Some logs do rotate and compress. No Exim logs do.


    /etc/logrotate.d/exim is as follows:

    Code:
    /var/log/exim_mainlog {
        create 0640 mailnull mail
        compress
        postrotate
        /usr/bin/killall -HUP exim
        endscript
    }
    /var/log/exim_paniclog {
        missingok
        create 0640 mailnull mail
        compress
        postrotate
        /usr/bin/killall -HUP exim
        endscript
    }
    /var/log/exim_rejectlog {
        create 0640 mailnull mail
        compress
        postrotate
        /usr/bin/killall -HUP exim
        endscript
    }
    which also clearly says compress.
     
    #1 lloyd_tennison, Jan 10, 2006
    Last edited: Jan 10, 2006
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Just to check, is this line in your /etc/logrotate.conf:

    include /etc/logrotate.d

    I don't have compress enabled in logrotate.conf and my exim logs are always rotated with the directive within /etc/logrotate.d/exim
     
  3. lloyd_tennison

    lloyd_tennison Well-Known Member

    Joined:
    Mar 12, 2004
    Messages:
    698
    Likes Received:
    1
    Trophy Points:
    18
    Yes, it is, and all the other logs rotate that have commands in that directory.
     
  4. nathacof

    nathacof Member

    Joined:
    Feb 28, 2007
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    I have a customer who is on a Virtual Private Server.

    root@h101606 [/var/log]# cat /etc/fedora-release
    Fedora Core release 4 (Stentz)
    root@h101606 [/var/log]#

    cPanel v. 10.2.0

    Same problem /etc/logrotate.d/exim follows:

    root@h101606 [/var/log]# cat /etc/logrotate.d/exim
    /var/log/exim_mainlog {
    create 0640 mailnull mail
    compress
    postrotate
    /usr/bin/killall -HUP exim
    endscript
    }
    /var/log/exim_paniclog {
    missingok
    create 0640 mailnull mail
    compress
    postrotate
    /usr/bin/killall -HUP exim
    endscript
    }
    /var/log/exim_rejectlog {
    create 0640 mailnull mail
    compress
    postrotate
    /usr/bin/killall -HUP exim
    endscript
    }

    root@h101606 [/var/log]#


    Excerpt from /var/log/messages :

    Apr 30 05:56:01 h101606 logrotate: ALERT exited abnormally with [1]
    May 1 05:56:01 h101606 logrotate: ALERT exited abnormally with [1]
    May 2 05:56:01 h101606 logrotate: ALERT exited abnormally with [1]
    May 3 05:56:02 h101606 logrotate: ALERT exited abnormally with [1]
    May 4 05:56:02 h101606 logrotate: ALERT exited abnormally with [1]
    May 5 05:56:01 h101606 logrotate: ALERT exited abnormally with [1]
    May 6 05:56:01 h101606 logrotate: ALERT exited abnormally with [1]
    May 7 05:56:01 h101606 logrotate: ALERT exited abnormally with [1]
    root@h101606 [/var/log]#

    root@h101606 [/var/log]# cat /etc/cron.daily/logrotate
    #!/bin/sh
    export TMPDIR=/var/spool/logrotate/tmp

    /usr/sbin/logrotate /etc/logrotate.conf
    EXITVALUE=$?
    if [ $EXITVALUE != 0 ]; then
    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
    fi
    exit 0
    root@h101606 [/var/log]#

    Problem is these logs all indicate that HTTP logs could not be found and the errors are not actually associated with exim's logrotate configuration.

    root@h101606 [/etc/logrotate.d]# logrotate -vf /etc/logrotate.conf
    reading config file /etc/logrotate.conf
    including /etc/logrotate.d
    reading config file exim
    reading config info for /var/log/exim_mainlog
    reading config info for /var/log/exim_paniclog
    reading config info for /var/log/exim_rejectlog
    reading config file httpd
    error: error accessing /var/log/httpd: No such file or directory
    error: httpd:1 glob failed for /var/log/httpd/*log
    [1]+ Done updatedb
    root@h101606 [/etc/logrotate.d]#

    Here is my /etc/logrotate.conf

    root@h101606 [/etc/logrotate.d]# cat /etc/logrotate.conf
    # see "man logrotate" for details
    # rotate log files weekly
    weekly

    # keep 4 weeks worth of backlogs
    rotate 4

    # create new (empty) log files after rotating old ones
    create

    # uncomment this if you want your log files compressed
    compress

    # RPM packages drop log rotation information into this directory
    include /etc/logrotate.d

    # no packages own wtmp, or btmp -- we'll rotate them here
    /var/log/wtmp {
    monthly
    create 0664 root utmp
    rotate 1
    }
    /var/log/btmp {
    missingok
    monthly
    create 0600 root utmp
    rotate 1
    }
    # system-specific logs may be also be configured here.
    root@h101606 [/etc/logrotate.d]#


    Just to be clear everything appears to be working. Except for the rotation and compression of the log files.... which indicates that nothing is actually working.

    Any ideas on this?
     
  5. nathacof

    nathacof Member

    Joined:
    Feb 28, 2007
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    Well we see the problem then.

    When logrotate hits an invalid configuration it halts without continuing

    duh

    thanks!
     
Loading...

Share This Page