1

I have default Debian 8.5 Jessie /etc/logrotate.conf contents:

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

# keep 4 weeks worth of backlogs
rotate 4

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

# uncomment this if you want your log files compressed
#compress

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

# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp {
    missingok
    monthly
    create 0664 root utmp
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0660 root utmp
    rotate 1
}

# system-specific logs may be configured here

With this settings logrotate does its jobs well. However, if I change:

rotate 4

to something different, for example to:

rotate 5

logrotate never does its job, consuming all the CPU power so I have to kill its process eventually.

Why is that? Should I change something when tuning rotate?

  • actually I don't think my previous comments were right. I was confusing logrotate with rsyslog. Try looking for some command to parse/debug the logrotate config without actually applying it. – the_velour_fog Aug 9 '16 at 7:30
  • What is exactly the size of your log file? – Rui F Ribeiro Aug 9 '16 at 9:25
  • @RuiFRibeiro I have plenty of those. – TranslucentCloud Aug 9 '16 at 9:35
  • any big log files? – Rui F Ribeiro Aug 9 '16 at 9:41
  • No, everything is in range of up to 1 MB. – TranslucentCloud Aug 9 '16 at 9:50
2

Try looking for some command to parse/debug the logrotate config without actually applying it.

from man logrotate

     -d, --debug                                                              
            Turns  on  debug mode and implies -v.  In debug mode, no changes  
            will be made to the logs or to the logrotate state file.

to use you would run

logrotate -d /etc/logrotate.conf
  • 1
    I've successfully debugged logrotate, some log files with really long log rotation times seemingly putted the tool into some kind of near-infinite loop. I've archived these logs manually and now logrotate runs just fine, even with rotate 28 in /etc/logrotate.conf. – TranslucentCloud Aug 9 '16 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.