0

With the logrotate config. below I was expecting the program to start compressing log files after creating the first backup file. Instead I am seeing this:

[root@host ~]# ll /var/log
total 1.2M
drwxr-xr-x 2 root root 4.0K Aug 31 13:29 ./
drwxrwxr-x 7 1000 1000 4.0K Aug 29 01:49 ../
-rw-r--r-- 1 root root  289 Aug 29 02:11 auth.log.1
-rw-r--r-- 1 root root  382 Aug 31 00:59 cron.log.1
-rw-r--r-- 1 root root  41K Aug 31 14:16 messages
-rw-r--r-- 1 root root 201K Aug 31 13:26 messages.0
-rw-r--r-- 1 root root 201K Aug 30 23:11 messages.0.1
-rw-r--r-- 1 root root  88K Aug 31 00:59 messages.1
-rw-r--r-- 1 root root  38K Aug 31 14:16 user.log
-rw-r--r-- 1 root root 201K Aug 31 13:29 user.log.0
-rw-r--r-- 1 root root 201K Aug 30 23:12 user.log.0.1
-rw-r--r-- 1 root root  89K Aug 31 01:02 user.log.1

[root@host ~]# cat /etc/logrotate.conf
compress

include /etc/logrotate.d

/var/log/* {
        rotate 7
        daily
    delaycompress
        missingok
        sharedscripts
        postrotate
                /usr/bin/killall -HUP syslogd
        endscript
}

The target system is BusyBox v1.20.2.

Perhaps the problem is that I've specified to rotate all logs under /var/log, instead of naming them each explicitly? I would prefer to be able to just say rotate all logs under /var/log however and have it work as expected.

2
  • 1
    you probably have rules in /etc/logrotate.d/* that conflict.
    – meuh
    Commented Aug 31, 2015 at 14:31
  • Good suggestion, but I have no files in that directory, onlt the single config. file above.
    – SeanLabs
    Commented Aug 31, 2015 at 15:06

1 Answer 1

1

The problem is that /var/log/* is too wide and so matches previously rotated files and rotates them again. You either need to specify a more explicit list, or a more restricted wildcard pattern, or move old logs into a new dir so they wont be mistaken. I would replace, for example,

/var/log/* { ... }

by

/var/log/*.log /var/log/messages { ... }
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .