I have apache setup to generate new log files everyday:
CustomLog "|/usr/sbin/rotatelogs -f /var/log/apache2/access.log.%Y-%m-%d-%H_%M 86400" combined
Then I'm trying to use logrotate to zip these files:
/var/log/apache2/access.log.* {
compress
create 0644 root root
daily
delaycompress
missingok
maxage 7
}
What happens is that I get a bunch of files that look like:
-rw-r--r-- 1 root root 20 2011-11-26 06:49 access.log.2011-11-21-00_00.1.1.3.gz
-rw-r--r-- 1 root root 33 2011-11-26 06:49 access.log.2011-11-21-00_00.2.gz.3.gz
-rw-r--r-- 1 root root 20 2011-11-26 06:49 access.log.2011-11-21-00_00.3.gz.3.gz
-rw-r--r-- 1 root root 20 2011-11-26 06:49 access.log.2011-11-22-00_00.1.1.3.gz
-rw-r--r-- 1 root root 33 2011-11-26 06:49 access.log.2011-11-22-00_00.2.gz.3.gz
-rw-r--r-- 1 root root 20 2011-11-26 06:49 access.log.2011-11-22-00_00.3.gz.3.gz
-rw-r--r-- 1 root root 20 2011-11-26 06:49 access.log.2011-11-23-00_00.1.3.gz
-rw-r--r-- 1 root root 33 2011-11-26 06:49 access.log.2011-11-23-00_00.2.gz.3.gz
-rw-r--r-- 1 root root 44590255 2011-11-25 18:59 access.log.2011-11-25-00_00.4.gz
-rw-r--r-- 1 root root 20 2011-11-25 06:42 access.log.2011-11-23-00_00.1.4.gz
-rw-r--r-- 1 root root 20 2011-11-25 06:42 access.log.2011-11-24-00_00.4.gz
-rw-r--r-- 1 root root 20 2011-11-25 06:42 access.log.2011-11-21-00_00.1.4.gz
-rw-r--r-- 1 root root 33 2011-11-25 06:42 access.log.2011-11-21-00_00.2.gz.4.gz
-rw-r--r-- 1 root root 20 2011-11-25 06:42 access.log.2011-11-22-00_00.1.4.gz
-rw-r--r-- 1 root root 33 2011-11-25 06:42 access.log.2011-11-22-00_00.2.gz.4.gz
What I want is to have a new file generated everyday and have the previous days file gzip'd. How should I setup my logrotate to do that?