Bug 448622 - logrotate ignore size commands less than 1M
Summary: logrotate ignore size commands less than 1M
Keywords:
Status: CLOSED DUPLICATE of bug 247410
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: logrotate
Version: 5.1
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Tomas Smetana
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-05-27 21:48 UTC by Stephane Saux
Modified: 2008-06-03 12:10 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-06-03 12:10:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
captured shell session (1.11 KB, text/plain)
2008-05-29 16:52 UTC, Stephane Saux
no flags Details

Description Stephane Saux 2008-05-27 21:48:29 UTC
Description of problem:

isting below (this is a test case:
first list the size of the file to rotate.
Then show the test logrotate.conf
Issue log rotate command. The file is not rotated.
Note that the command says "rotating pattern... 1048576 bytes..."
even though it states below that it will consider file >=1024bytes.
Well, it doesn't appear to do that. An earlier version of logrotate
from RedHat will rotate.

[ssaux@stg1 logrotate]$ ll log/test.log
-rw-rw-r-- 1 ssaux gate 18896 Apr  8 18:13 log/test.log
[ssaux@stg1 logrotate]$ cat etc/logrotate.conf
#
#daily

# keep only one file.
rotate 1

# create new (empty) log files after rotating old ones
create
compress
missingok
notifempty
create 0664 ssaux gate

/home/ssaux/tmp/logrotate/log/test.log {
        size 1k
}
[ssaux@stg1 logrotate]$ /usr/sbin/logrotate -dv -s
/home/ssaux/tmp/logrotate/etc/logrotate.state
/home/ssaux/tmp/logrotate/etc/logrotate.conf
reading config file /home/ssaux/tmp/logrotate/etc/logrotate.conf
reading config info for /home/ssaux/tmp/logrotate/log/test.log

Handling 1 logs

rotating pattern: /home/ssaux/tmp/logrotate/log/test.log  1048576 bytes (1
rotations)
empty log files are not rotated, only log files >= 1024 bytes are rotated,
old logs are removed
considering log /home/ssaux/tmp/logrotate/log/test.log
  log does not need rotating

====================================================================== 

---------------------------------------------------------------------- 
 stephanesaux - 2008-04-11 23:18  
---------------------------------------------------------------------- 
Another bug in this version of logrotate:
Man page says that "daily" and "weekly" are ignore if a log uses "size"
(but not if the log uses "minsize":

       minsize size
              Log files are rotated when they grow bigger then size bytes,
but not before the additionally  specified  time  interval  (daily, 
weekly,
              monthly,  or  yearly).   The  related  size option is
similar except that it is mutually exclusive with the time interval
options, and it
              causes log files to be rotated without regard for the last
rotation time.  When minsize is used, both the size and  timestamp  of  a 
log
              file are considered.

But logrotate treats size and minsize the same.

Again, Redhat 3 behaves according to the man page.

Comment 1 Tomas Smetana 2008-05-28 06:36:12 UTC
I've tried to reproduce your problem with logrotate-3.7.4-8, but everything
looks to be OK:

[tsmetana@dhcp-lab-208 logrotate-size]$ ll
total 40
-rw-rw-r-- 1 tsmetana tsmetana   104 May 28 06:25 config
-rw-rw-r-- 1 tsmetana tsmetana    84 May 28 06:29 status
-rw-rw-r-- 1 tsmetana tsmetana 18896 May 28 06:30 the_log


[tsmetana@dhcp-lab-208 logrotate-size]$ cat config 
rotate 1
create
compress
missingok
notifempty

/home/tsmetana/test/logrotate-size/the_log {
        size 1k
}


[tsmetana@dhcp-lab-208 logrotate-size]$ /usr/sbin/logrotate -vs status config 
reading config file config
reading config info for /home/tsmetana/test/logrotate-size/the_log 

Handling 1 logs

rotating pattern: /home/tsmetana/test/logrotate-size/the_log  1024 bytes (1
rotations)
empty log files are not rotated, old logs are removed
considering log /home/tsmetana/test/logrotate-size/the_log
  log needs rotating
rotating log /home/tsmetana/test/logrotate-size/the_log, log->rotateCount is 1
renaming /home/tsmetana/test/logrotate-size/the_log.1.gz to
/home/tsmetana/test/logrotate-size/the_log.2.gz (rotatecount 1, logstart 1, i 1), 
old log /home/tsmetana/test/logrotate-size/the_log.1.gz does not exist
renaming /home/tsmetana/test/logrotate-size/the_log.0.gz to
/home/tsmetana/test/logrotate-size/the_log.1.gz (rotatecount 1, logstart 1, i 0), 
old log /home/tsmetana/test/logrotate-size/the_log.0.gz does not exist
log /home/tsmetana/test/logrotate-size/the_log.2.gz doesn't exist -- won't try
to dispose of it
renaming /home/tsmetana/test/logrotate-size/the_log to
/home/tsmetana/test/logrotate-size/the_log.1
creating new log mode = 0664 uid = 500 gid = 500
compressing log with: /bin/gzip


[tsmetana@dhcp-lab-208 logrotate-size]$ ll
total 28
-rw-rw-r-- 1 tsmetana tsmetana 104 May 28 06:25 config
-rw-rw-r-- 1 tsmetana tsmetana  84 May 28 06:30 status
-rw-rw-r-- 1 tsmetana tsmetana   0 May 28 06:30 the_log
-rw-rw-r-- 1 tsmetana tsmetana  53 May 28 06:30 the_log.1.gz


What version of logrotate do you have installed?

Comment 2 Stephane Saux 2008-05-29 16:50:25 UTC
[ssaux@stg1 logrotate]$ /usr/sbin/logrotate -dv
logrotate 3.7.4 - Copyright (C) 1995-2001 Red Hat, Inc.
This may be freely redistributed under the terms of the GNU Public License

Usage: logrotate [-dfv?] [-d|--debug] [-f|--force] [-m|--mail command]
        [-s|--state statefile] [-v|--verbose] [-?|--help] [--usage]
        [OPTION...] <configfile>



Comment 3 Stephane Saux 2008-05-29 16:52:03 UTC
Created attachment 307110 [details]
captured shell session

Comment 4 Tomas Smetana 2008-05-30 05:39:10 UTC
I need to know also the release number of the package.  Please send me the
output of 'rpm -q logrotate'.

Comment 5 Stephane Saux 2008-05-30 15:46:20 UTC
[ssaux@stg1 home]$ rpm -q logrotate
logrotate-3.7.4-7



Comment 6 Tomas Smetana 2008-06-02 11:39:34 UTC
Please update to 3.7.4-8.  What you report seems to be a duplicate of bug #247410.

Comment 7 Tomas Smetana 2008-06-03 12:10:57 UTC

*** This bug has been marked as a duplicate of 247410 ***


Note You need to log in before you can comment on or make changes to this bug.