4

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
weekly

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

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

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

# 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 {
    monthly
    minsize 1M
    create 0664 root utmp
    rotate 1
}

# system-specific logs may be also be configured here.
siliconpi
  • 1,807
  • 6
  • 32
  • 46

1 Answers1

4

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.

Edit:

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

user9517
  • 115,471
  • 20
  • 215
  • 297
  • 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 05:47
  • @matt74tm: Options outside of {} are global. You can override them inside {}. – user9517 May 28 '11 at 06:33