My /etc/logrotate.conf :

# see "man logrotate" for details
# rotate log files weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones

# use date as a suffix of the rotated file

# uncomment this if you want your log files compressed

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
    create 0664 root utmp
        minsize 1M
    rotate 1

/var/log/btmp {
    create 0600 root utmp
    rotate 1

# system-specific logs may be also be configured here.

My Logs to be rotated /etc/logrotate.d/apc_rtbinfo.conf

/mnt/log/frengo/apc_rtbinfo.log {
size 2000M
rotate 3

Output for logrotate :

 logrotate -v /etc/logrotate.d/apc_rtbinfo.conf
reading config file /etc/logrotate.d/apc_rtbinfo.conf
reading config info for /mnt/log/frengo/apc_rtbinfo.log

Handling 1 logs

rotating pattern: /mnt/log/frengo/apc_rtbinfo.log  2097152000 bytes (3 rotations)
empty log files are not rotated, old logs are removed
considering log /mnt/log/frengo/apc_rtbinfo.log
  log does not need rotating

My rotated Logs size :

# du -sh /mnt/log/frengo/apc_rtbinfo.log*
0       /mnt/log/frengo/apc_rtbinfo.log
4.7G    /mnt/log/frengo/apc_rtbinfo.log.1
80M     /mnt/log/frengo/apc_rtbinfo.log.2
0       /mnt/log/frengo/apc_rtbinfo.log-20151222
679M    /mnt/log/frengo/apc_rtbinfo.log-20151225.gz
681M    /mnt/log/frengo/apc_rtbinfo.log-20151226.gz
691M    /mnt/log/frengo/apc_rtbinfo.log-20151227.gz
0       /mnt/log/frengo/apc_rtbinfo.log-20151228
70M     /mnt/log/frengo/apc_rtbinfo.log.2.gz
80M     /mnt/log/frengo/apc_rtbinfo.log.3
80M     /mnt/log/frengo/apc_rtbinfo.log.4

Log rotate output says "log does not need rotating" but I have mentioned "size 2000M" ie Log file is rotated if it grow bigger than 2000M then how come "/mnt/log/frengo/apc_rtbinfo.log.1" is 4.7 GB

  • It seems pretty normal, it does rotate them if > than 2GB, and the current one is 0, of course it wont be rotated. I fail to see the problem. Commented Dec 28, 2015 at 16:14
  • So will it rote after day one ? ie till then file size can grow to any size ? Commented Dec 28, 2015 at 16:16
  • @RuiFRibeiro though apc_rtbinfo.log is zero but my isuue is that apc_rtbinfo.log.1 is more than 2GB which shold shouldn't be this is my problem coz it was not 2GB before I ran logrote so I feel I don't deserve "-1" down vote Commented Dec 28, 2015 at 16:31
  • 1
    What are the modification times on all those log files? I'd like to see if logrotate is creating backups using the .1 .2 method or the date method (or both). You have dateext in the config file. It's possible something else is rotating them as well, and that something else created the .1 file. Commented Dec 28, 2015 at 16:40

1 Answer 1


It's the current log file's size (/mnt/log/frengo/apc_rtbinfo.log) that is considered, and that size is 0. So, nothing to rotate.

As for the older log file, logrotate doesn't constantly monitor files, but is run regularly (daily, iirc). If, between runs, a log file grows extraordinarily large, it won't find out until the next run.

If space is at a premium, just run gzip on the large file:

gzip /mnt/log/frengo/apc_rtbinfo.log

It will be replaced with a compressed, much smaller, file.

You have used the size and daily conditions together. However, size and the time-based conditions are mutually exclusive. You should use the maxsize condition instead:

maxsize size
      Log files are rotated when they grow bigger than size bytes even
      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 maxsize is used,  both  the  size  and
      timestamp of a log file are considered.
  • The point is not running daily, it is running at least daily. If the OP happens to run logrotate by hand, it will only run after two days, and hence the confusion. Commented Dec 28, 2015 at 16:18
  • Is there anything to rotate deepening on size Commented Dec 28, 2015 at 16:21
  • @RuiFRibeiro Why do you think running logrotate manually will delay the next run? O.o
    – muru
    Commented Dec 28, 2015 at 16:22
  • @AshishKarpe Nothing that constantly monitors the size. You are looking at the wrong problem. You should be inspecting whatever's flooding your logs.
    – muru
    Commented Dec 28, 2015 at 16:23
  • because the 24h (day) are based on approximate calculations the last date of the last log (i.e. log.1...) . So if you run manually in a day, by the time logrotate is launched automatically the 24h have not yet gone by. Commented Dec 28, 2015 at 16:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .