Score:0

rsyslog how can i compress all messages with templates

us flag

Aside from storing log messages to specific files, I am trying to also compress them for archiving purposes. Logrotate will just rotate plain files.

The way I tried to solve this is by adding a template for each file. For example:

$OMFileZipLevel 6.  
$template. MAILLOG,"/archive/%$YEAR%/%$MONTH%/%$DAY%/maillog.gz". 
$OMFileZipLevel 6
$template MESSAGES,"/archive/%$YEAR%/%$MONTH%/%$DAY%/messages.gz".

*.emerg                   /var/logs/messages
& -?MESSAGES

local3.*                  /var/log/maillog
& -?MAILLOG

That works fine, however if I have twenty different files I will have to create 20 different templates and add the $OMFileZipLevel 3. prior to each template.

Is there any other way to achieve these without repeating $OMFileZipLevel 3. and by using a single template?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.