Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.
share|improve this question

1 Answer 1

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.

share|improve this answer
    
oh... so this wtmp file is just a filename specified by my system? I tried opening it, but it had binary data in it. –  matt74tm May 21 '11 at 16:48
    
wtmp is the file that login/logout information for your system is recorded to. –  Iain 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 { } –  matt74tm May 28 '11 at 5:47
    
@matt74tm: Options outside of {} are global. You can override them inside {}. –  Iain May 28 '11 at 6:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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