Skip to content

Instantly share code, notes, and snippets.

@jlengstorf
Last active December 18, 2015 05:49
Show Gist options
  • Save jlengstorf/5735685 to your computer and use it in GitHub Desktop.
Save jlengstorf/5735685 to your computer and use it in GitHub Desktop.
Avoid Huge Processed Logs in Media Temple: Use this updated `logrotate.conf` to avoid the giant logfiles that show up on Media Temple's (dv) servers.

Avoid Huge Logs on a (dv) Server

The default setup of a (dv) server by Media Temple has logs set up to rotate weekly and without compression. This can result in huge log files that eat server resources and—as I've learned first-hand—kill your server.

Fortunately, this is really easy to work around. All it takes is:

  • Root access to your server
  • (Very) basic knowledge of the command line

How To Edit logrotate.conf

In a terminal, connect to your server as root (or as a user with sudo privileges).

ssh [email protected]

Using vim or the editor of your choice, edit /etc/logrotate.conf:

vim /etc/logrotate.conf

Adjust the configuration settings as shown in the attached logrotate.conf file.

Hat tip to Roger Stringer for pointing me in the right direction.

# see "man logrotate" for details
# rotate log files daily
daily
# keep 2 days' worth of backlogs
rotate 2
# create new (empty) log files after rotating old ones
create
# compresses log files for smaller footprint
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 {
daily
minsize 1M
create 0664 root utmp
compress
rotate 2
}
/var/log/btmp {
missingok
daily
minsize 1M
create 0600 root utmp
compress
rotate 2
}
# system-specific logs may be also be configured here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment