How to clean up wtmp files that grow too big on RHEL3?

Solution Verified - Updated -

Environment

Red Hat Enterprise Linux 3 (RHEL3)

Issue

The file /var/log/wtmp grows fast and takes too much disk space

Resolution

logrotate handles the rotation of /var/log/wtmp. As wtmp is not owned by a specific package, its logrotate configuration is not in /etc/logrotate.d but directly in /etc/logrotate.conf.

Here is the default configuration:

/var/log/wtmp {
    monthly
    create 0664 root utmp
    rotate 1
}

To make wtmp rotate more frequently (therefore preventing it to grow too much) change the frequency of the rotation from monthly to weekly and/or set a size-based threshold for rotation.

You might want to take measures for backing up old wtmp files and/or increase the number of old copies kept by logrotate. See logrotate(8) for details.

Root Cause

The default logrotate configuration might not be ideal for your system's usage pattern (login frequency).

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments