Node:Compressing logs, Neste:, Forrige:Running user scripts, Opp:Global configurations



Compressing old log files

In the previous two sections we have looked at how to rotate old log files and how to execute shell commands. If you keep a lot of old log files around on your system, you might want to compress them so that they don't take up so much space. You can do this with a shell command. The example below looks for files matching a shell wildcard. Names of the form file.1, file.2...file.10 will match this wildcard and the compression program sees that they get compressed. The output is dumped to avoid spurious messages.

shellcommands:

  "$(gnu)/gzip /var/log/*.[0-9] /var/log/*.[0-9][0-9]  > /dev/null 2>&1"

Cfengine will also recognize rotated files if they have been compressed, with suffixes .Z, .gz, .rbz or .rbz.