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

include /etc/logrotate.d

/var/log/* {
        rotate 7
                /usr/bin/killall -HUP syslogd

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.

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

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/* { ... }


/var/log/*.log /var/log/messages { ... }
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.