Compressing Linux logfiles


I have a few Redhat Linux servers that log application data to one or more logfiles in /var/log. For some reason Redhat Linux doesn’t compress the logfiles in /var/log by default, which can be a problem if your logging a lot of information, or if you need to keep logfiles around for historical reasons. To change this behavior and compress the logfiles that are stored in /var/log, you can uncomment the “compress” line in /etc/logadm.conf. This is a simple one line change, and the result should look similar to this:

# uncomment this if you want your log files compressed
compress

Once that change is made, the logfiles in /var/log will be compressed each time they are rotated.

This article was posted by Matty on 2006-09-09 14:58:00 -0400 -0400