Hi Radu! Thanks for the link, but I already know how to work with list templates from a conf perspective. I'm looking for good examples of accessing that data from code in an output plugin. Currently my plugin simply does this in CODESTARTdoAction:

CHKiRet(writeHiredis(ppString[0], pData));

This passes the entire output from the template as a string to redis. This works ok when I want to construct redis commands from templates using individual properties straight to hiredis's redisAppendCommand function, such as:

"HINCR progcount %programname% 1"

But it does not work when I want to send whole messages to redis (whitespace in the syslog message be interpreted as delimiters in the command, causing errors).

hiredis has another function however, redisAppendCommandArgv, that is variatic. In order to use this I would like to construct a list using the list templates, and then access each individual member of the list from the output plugin code so I can construct the array to pass to redisAppendCommandArgv. So, let's say I construct the following template:

template(name="redisPushQueue" type="list") {
    constant(value="LPUSH")
    constant(value="queue_key")
    property(name="msg")
}

From the output plugin code, how do I then access each member of this list individually with the new template code?

Make sense?

Brian






1) Can
On 1/3/2013 7:59 AM, Radu Gheorghe wrote:
Hello Brian,

Just to make sure we're not missing the obvious:
http://www.rsyslog.com/doc/rsyslog_conf_templates.html

Besides that, there are a couple of examples here:


2013/1/3 Brian Knox <[email protected]>

I've been working on some improvements for the omhiredis output plugin this
week.  I think I've come up with a better way of combining templates with
redis command formatting.  In order to do this, I need to, given a list
style template, get the number of elements in the list and the length of
each element.

I've only worked with string templates (from a plugin perspective) with my
output plugins so far.  Is there a good example somewhere for dealing with
list templates?

On other fronts, I now omhiredis working with batch dequeue in conjunction
with hiredis' pipeline commands.  In local tests this let me push around
250,000 redis commands per second to a redis instance (I was getting around
50k commands of the same type with the same test before the changes).

Rainer - I'm hoping to wrap up this next round of improvements in a few
days and get a patch your way!

Brian
_______________________________________________
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.

_______________________________________________
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.

_______________________________________________
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