Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 398219 - app-admin/logrotate ignores size option
Summary: app-admin/logrotate ignores size option
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Daniel Gryniewicz (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-09 09:10 UTC by Benjamin Schindler
Modified: 2012-01-11 14:40 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
main config file (logrotate.conf,860 bytes, text/plain)
2012-01-10 08:59 UTC, Benjamin Schindler
Details
logrotate.d directory (logrotate.d.zip,2.25 KB, text/plain)
2012-01-10 09:00 UTC, Benjamin Schindler
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Schindler 2012-01-09 09:10:39 UTC
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
Comment 1 Daniel Gryniewicz (RETIRED) gentoo-dev 2012-01-09 13:39:18 UTC
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?
Comment 2 Benjamin Schindler 2012-01-09 13:43:39 UTC
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
Comment 3 Daniel Gryniewicz (RETIRED) gentoo-dev 2012-01-09 16:09:48 UTC
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
Comment 4 Benjamin Schindler 2012-01-10 08:59:33 UTC
Created attachment 298475 [details]
main config file
Comment 5 Benjamin Schindler 2012-01-10 09:00:32 UTC
Created attachment 298477 [details]
logrotate.d directory
Comment 6 Daniel Gryniewicz (RETIRED) gentoo-dev 2012-01-11 13:31:36 UTC
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?
Comment 7 Benjamin Schindler 2012-01-11 13:33:38 UTC
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
Comment 8 Daniel Gryniewicz (RETIRED) gentoo-dev 2012-01-11 14:31:40 UTC
Okay, this is working correctly in 3.8.1.  You can upgrade to that now, or wait for it to go stable (bug #398529)
Comment 9 Benjamin Schindler 2012-01-11 14:40:29 UTC
Confirmed
Thank you