Hi,

I'm currently working on trying to use rsyslog as a basic load balancer, by 
selecting the output on a time basis. I'm using the discussion posted here as 
my starting point:

http://lists.adiscon.net/pipermail/rsyslog/2013-October/034442.html


In this discussion, the authors looked at using:

if ($uptime % 3 == 0) then action1
if ($uptime % 3 == 1) then action2

if ($uptime % 3 == 2) then action2


To use the system uptime to decide which way to send the events (so it would 
average over the three destinations). However, this didn't work in 7.4, as 
uptime is not available outside templates. I also found 8.4.2 to not like this 
parameter.

For the original discussion, what eventually seemed to work was:
field($timegenerated,':',3);
However - it's not clear how this was used, and I can't see how it would refer 
to three different destinations. It seems more of a string operation than a 
modulus. When I try using this, rsyslog debug mode generates no errors, so it 
seems to work. If I try something like:
if ($timegenerated % 3 == 0) then call output_0
if ($timegenerated % 3 == 1) then call output_1
if ($timegenerated % 3 == 2) then call output_2

Then it gives errors for these lines; it doesn't seem to work as an operation.

Can anyone clarify what the field($...) operation does, and how I can use it. 
Alternatively, any suggestions as to how I can basically call a different 
ruleset if the system/event seconds value is modulus 0, 1, or 2.

Thanks!


Damian
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of 
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE 
THAT.

Reply via email to