I have huge apache logs so I wanted logrotate to make them smaller. My apache2 logrotate file looks as follows: /var/log/apache2/*log { missingok notifempty sharedscripts size 5M postrotate /etc/init.d/apache2 reload > /dev/null 2>&1 || true endscript } The size of the logs are larger than 5mb as you can see: -rw-r--r-- 1 root root 27913739 Jan 8 20:10 redmine_access_log -rw-r--r-- 1 root root 174440 Jan 6 12:11 redmine_error_log -rw-r--r-- 1 root root 33627591 Jan 8 20:10 redmine_request_log -rw-r--r-- 1 root root 90339209 Jan 9 03:10 ssl_access_log -rw-r--r-- 1 root root 506466 Jan 6 12:11 ssl_error_log -rw-r--r-- 1 root root 95017450 Jan 9 03:10 ssl_request_log Yet, logrotate refuses to rotate (see below) Reproducible: Always Steps to Reproduce: 1. Use the mentioned logrotate file 2. run logrotate with logrotate -dv /etc/logrotate.conf (i have a stock logrotate.conf file) 3. Actual Results: rotating pattern: /var/log/apache2/*log weekly (4 rotations) empty log files are not rotated, only log files >= 5242880 bytes are rotated, old logs are removed considering log /var/log/apache2/access_log log does not need rotating considering log /var/log/apache2/error_log log does not need rotating considering log /var/log/apache2/redmine_access_log log does not need rotating considering log /var/log/apache2/redmine_error_log log does not need rotating considering log /var/log/apache2/redmine_request_log log does not need rotating considering log /var/log/apache2/ssl_access_log log does not need rotating considering log /var/log/apache2/ssl_error_log log does not need rotating considering log /var/log/apache2/ssl_request_log log does not need rotating not running postrotate script, since no logs were rotated Expected Results: all files except redmine_error_log should need rotation
The output you posted indicates a config file with: weekly 4 minsize 5M So, something is mismatched here. Are you sure that that is the correct file? What command did you run to get that output?
The weekly 4 comes from the default config file which is shipped by gentoo (its in /etc/logrotate.conf). The command to reproduce I posted: logrotate -dv /etc/logrotate.conf Cheesr Benjamin
The "weekly" in the main config file is just a default, and is overridden when you specify "size" (and that happens here, see below. Which version do you have? If you don't think it's a security issue, could you post a tarball of /etc/logrotate.conf and /etc/logrotate.d? Here's my test output with the latest version: [11:03 athena] logrotate> logrotate -dv logrotate.conf reading config file logrotate.conf including /home/dang/tmp/logrotate/logrotate.d reading config file apache Handling 2 logs rotating pattern: /home/dang/tmp/logrotate/logs/*log 5242880 bytes (4 rotations) empty log files are not rotated, old logs are removed considering log /home/dang/tmp/logrotate/logs/test1.log log needs rotating considering log /home/dang/tmp/logrotate/logs/test2.log log does not need rotating considering log /home/dang/tmp/logrotate/logs/test3.log log does not need rotating rotating log /home/dang/tmp/logrotate/logs/test1.log, log->rotateCount is 4 dateext suffix '-20120109' glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' glob finding old rotated logs failed renaming /home/dang/tmp/logrotate/logs/test1.log to /home/dang/tmp/logrotate/logs/test1.log-20120109 creating new /home/dang/tmp/logrotate/logs/test1.log mode = 0664 uid = 1000 gid = 1012 compressing log with: /bin/gzip rotating pattern: /home/dang/tmp/logrotate/test.log after 1 days (4 rotations) empty log files are not rotated, old logs are removed considering log /home/dang/tmp/logrotate/test.log log does not need rotating
Created attachment 298475 [details] main config file
Created attachment 298477 [details] logrotate.d directory
Okay, something is definitely odd, since I get this with your actual config: rotating pattern: /var/log/apache2/*log 5242880 bytes (4 rotations) empty log files are not rotated, old logs are removed Which version did you have?
Hi bschindl@hundertwasser /local/Data $ emerge -pv logrotate These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild R ] app-admin/logrotate-3.8.0 USE="acl (-selinux)" 0 kB Cheers benjamin
Okay, this is working correctly in 3.8.1. You can upgrade to that now, or wait for it to go stable (bug #398529)
Confirmed Thank you