[syslog-ng]Logrotate ?

Brian Ipsen syslog-ng@lists.balabit.hu
Sat, 19 Feb 2005 00:14:44 +0100


Hi,

 The re-occurring question... How com that logrotate isn't working on my
logs ??

I have a file in /etc/logrotate.d like this:

/var/log/snmp/*.log {
    weekly
    notifempty
    compress
    sharedscripts
    missingok
    prerotate
        /bin/kill -HUP `cat /var/run/syslog-ng.pid 2> /dev/null` 2>
/dev/null || true
        /etc/init.d/syslog-ng restart
    endscript
    postrotate
        /bin/kill -HUP `cat /var/run/syslog-ng.pid 2> /dev/null` 2>
/dev/null || true
        /etc/init.d/syslog-ng restart
        touch /var/log/snmp/network.log /var/log/snmp/snmptrapd.log
/var/log/snmp/ups.log /var/log/snmp/vpn.log /var/log/snmp/witraz.log
    endscript
}

I did the kill -HUP both as pre- and post-rotate because there seems to a
problem, I've even tried to restart the daemon - nothing helps... 
Checking my /var/log/snmp dir gives me:

-rw-r--r--    1 root     root      2935158 Feb 18 20:12 network.log
-rw-------    1 root     root         1106 Nov 18 23:44 network.log.1.gz
-rw-------    1 root     root         7981 Aug 24 21:19 network.log.2.gz
-rw-------    1 root     root         1664 Jul 31  2004 network.log.3.gz
-rw-------    1 root     root         7012 Jul 23  2004 network.log.4.gz
-rw-r--r--    1 root     root     70908362 Feb 18 20:14 snmptrapd.log
-rw-------    1 root     root        28929 Nov 19 04:00 snmptrapd.log.1.gz
-rw-------    1 root     root         4591 Aug 25 02:58 snmptrapd.log.2.gz
-rw-------    1 root     root         3366 Aug  1  2004 snmptrapd.log.3.gz
-rw-------    1 root     root         4729 Jul 25  2004 snmptrapd.log.4.gz
-rw-r--r--    1 root     root          767 Feb  3 09:43 ups.log
-rw-------    1 root     root          467 Aug 24 14:36 ups.log.1.gz
-rw-------    1 root     root          220 Jul 15  2004 ups.log.2.gz
-rw-r--r--    1 root     root     36442477 Feb 18 20:10 vpn.log
-rw-r--r--    1 root     root      1045305 Dec 30 10:35 vpn.log.1.gz
-rw-------    1 root     root        36723 Nov 21 03:56 vpn.log.2.gz
-rw-r--r--    1 root     root          104 Nov  4 09:40 vpn-trap.log.1.gz
-rw-r--r--    1 root     root      1533667 Feb 17 17:17 witraz.log
-rw-------    1 root     root          553 Nov 19 17:49 witraz.log.1.gz
-rw-------    1 root     root          187 Aug 24 15:56 witraz.log.2.gz
-rw-------    1 root     root          620 Jul 31  2004 witraz.log.3.gz
-rw-------    1 root     root          703 Jul 24  2004 witraz.log.4.gz

I've rotated some of the logfiles manually - but check e.g. network.log -
it's been 3 months since last rotate ??

I'm running on a RHEL 3.0

Any idea why this logrotate isn't working ??

/Brian