Thursday, March 24, 2011

using failover and asynchronous actions in rsyslog

I wanted to point out that failover actions and asynchronous processing does not work well in rsyslog -- at least if a simple approach is used. The reason is that there is a conceptual problem with them working both together: async actions will - by design - always return an "everything went OK" status (because we don't know otherwise, as things are async!). So this means failover processing will never see an error.

Now look the following config:

$modload imuxsock
$ActionQueueType LinkedList
$RepeatedMsgReduction on
*.* @@10.48.20.19:10514
$ActionExecOnlyWhenPreviousIsSuspended on
& @@10.48.20.18:10514
& -/home/logfile2
$ActionExecOnlyWhenPreviousIsSuspended off


If the Action Queue Type is set to linked list (and thus the action executed asynchronously), the other two actions will never be executed - because the async action always "succeeds".

There are two ways to solve this situation:
1) do run the action synchronously -- depending on your needs, this may be a solution or not
2) if you need to run it async, you need to define a new ruleset, which includes the config WITHOUT the async processing. Then, use omruleset to execute the newly defined ruleset as whole asynchronously. This is obviously a bit more complex, but will do what you need.

I hope this resolves some confusion about the failover functionality (and, yes, a better config language would make this less painful -- hopefully we will finally be able to write one ;)).
Post a Comment