I have the following lines in my /etc/logrotate.conf file which I'm not quite sure what they do:

(Edited in to show full file)

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

# keep 52 weeks worth of backlogs
rotate 52    # <-- added it by me

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

# 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 -- we'll rotate them here
/var/log/wtmp {
    minsize 1M
    create 0664 root utmp
    rotate 1

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

You may want to refer to the logrotate man pages however;

  • /var/log/wtmp - the file that is to be processed
  • monthly - process the file the first time logrotate runs each month.
  • minsize 1M - The file has to be larger than minsize bytes before it will be processed
  • create ... - The new log file will be created with these permissions and owner/group
  • rotate 1 - the file will only be rotated once so only one earlier version of the file will be kept.

Putting it all together

The first time logrotate runs each month, check the size of the /var/log/wtmp file and if it is larger than 1M bytes rotate it. If an earlier version of the file exists, delete the earlier version. Create a new /var/log/wtmp file owned by root of group utmp with permissions 0644.


The wtmp file stores the login and logout information for your system. See the wtmp man page for more information.

  • oh... so this wtmp file is just a filename specified by my system? I tried opening it, but it had binary data in it. – siliconpi May 21 '11 at 16:48
  • wtmp is the file that login/logout information for your system is recorded to. – user9517 May 21 '11 at 16:50
  • @lain - sorry to bother you, i've just updated the main question with the full file contents. I'm having difficulty understanding what the rotate 52 in the beginning does as opposed to the one in /var/log/wtmp { } – siliconpi May 28 '11 at 5:47
  • @matt74tm: Options outside of {} are global. You can override them inside {}. – user9517 May 28 '11 at 6:33

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.