Skip to content

LZMA2 (XZ) Compression for Logrotate

07/09/2010

Here’s a little trick to increase compression rate and keep the /var/log directory clean.

First, create the directory /var/log/archive with mkdir (as root).

Now, add these lines to /etc/logrotate.conf:

compress
compresscmd /usr/bin/xz
uncompresscmd /usr/bin/unxz
compressext .xz
compressoptions -9
olddir /var/log/archive

As of now, when logrotate runs, it will compress the log files with xz (which provides better compression then gzip and bzip2 in most cases), and place the rotated logs in /var/log/archive. This is assuming you have logrotate and xz (often called something like xz-utils) installed. Less diskspace usage, less clutter. Neat!

From → Configuration

3 Comments
  1. Leuke site!. Er zijn nog weinig goede sites over dit onderwerp te vinden.
    Ben blij met jullie toevoeging!
    Ik kan helaas geen bookmark aanmaken naar 100percentlinux.wordpress.com in Firefox. :( Weten jullie hoe dit komt?

    Groetjes Barbara

    • John permalink

      Dank je voor je vriendelijke woorden.
      Geen idee waarom je deze site niet kan bookmarken in Firefox. Ik heb eigenlijk nog nooit meegemaakt dat je iets niet kon bookmarken in Firefox. Probeer anders eens de bookmark handmatig in te voeren?

      Groetjes, John

Trackbacks & Pingbacks

  1. Linuxaria Programmi di compressione su Linux : Linuxaria

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.