Happy Monday - getting ready to revisit the improvements to the template
handling I'd like to make to omhiredis.  To sum up the thread so far:

1) I can register from the plugin how I would like to handle the template
2) I should probably use the JSON method as array will be deprecated

So my question is now - if I use a "list" style template declaration, what
sort of JSON object will I end up with?

For a concrete example:

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

And here's the function I'm passing to:
void redisAppendCommandArgv(redisContext *c, int argc, const char
**argv, const size_t *argvlen);

So if I could pass this as essentially a JSON array ["LPUSH", "queue_key",
"msg"] that would make life easy.

Brian


On Sat, Jan 5, 2013 at 3:56 PM, Brian Knox <[email protected]> wrote:

> Aha!  Thanks for the info David - I wouldn't want to build on top of a
> feature that may be deprecated in the near future.
>
> Brian
>
>
> On Fri, Jan 4, 2013 at 8:30 PM, David Lang <[email protected]> wrote:
>
>> It's probably better to use JSON instead of array. Array is a very early
>> thing and there is some talk of phasing it out rather than needing to
>> support multiple ways of passing groups of messages.
>>
>> David Lang
>>
>>
>>  On Fri, 4 Jan 2013, Brian Knox wrote:
>>
>>  Aha!  I think in this case array passing may be what I need.  Thanks!
>>>
>>> Brian
>>> On 1/4/2013 4:00 AM, Rainer Gerhards wrote:
>>>
>>>> Quick hint: you need to set the param passing mode inside the plugin.
>>>> Not the template type specifies what you get, but the plugin asks the
>>>> engine. What you look for is JSON passing mode (or maybe array passing).
>>>> Ommongodb should help you, else ping me early next week.
>>>>
>>>> Rainer
>>>>
>>>>  -----Original Message-----
>>>>> From: 
>>>>> [email protected].**com<[email protected]>[mailto:
>>>>> rsyslog-
>>>>> [email protected]] On Behalf Of Brian Knox
>>>>> Sent: Thursday, January 03, 2013 2:22 PM
>>>>> To: [email protected]
>>>>> Subject: Re: [rsyslog] working with list templates
>>>>>
>>>>> 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<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://lists.adiscon.net/mailman/listinfo/rsyslog>
>>>>>>> http://www.rsyslog.com/**professional-services/<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://lists.adiscon.net/mailman/listinfo/rsyslog>
>>>>>> http://www.rsyslog.com/**professional-services/<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://lists.adiscon.net/mailman/listinfo/rsyslog>
>>>>> http://www.rsyslog.com/**professional-services/<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://lists.adiscon.net/mailman/listinfo/rsyslog>
>>>> http://www.rsyslog.com/**professional-services/<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://lists.adiscon.net/mailman/listinfo/rsyslog>
>>> http://www.rsyslog.com/**professional-services/<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://lists.adiscon.net/mailman/listinfo/rsyslog>
>> http://www.rsyslog.com/**professional-services/<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