Mailing List Archive

output numbers in JSON template
Is it possible to output unquoted numbers in a JSON template? using a format string?

For example:

property(outname="timestamp" name="timereported" dateFormat="unixtimestamp" format="jsonf")

produces "timestamp": "123456789".

obviously the much more error-prone does work, but then the option.jsonf can't be used via template(name="JSON" type="list" option.jsonf="on") any more:

constant(value="\",\"timestamp\":")
property(name="timegenerated" dateformat="unixtimestamp")
constant(value=",\...


thanks
Dave
_______________________________________________
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.
Re: output numbers in JSON template [ In reply to ]
On Wed, 9 Jan 2019, at 04:21, Dave Cottlehuber wrote:
> Is it possible to output unquoted numbers in a JSON template? using a
> format string?
>
> For example:
>
> property(outname="timestamp" name="timereported"
> dateFormat="unixtimestamp" format="jsonf")
>
> produces "timestamp": "123456789".
>
> obviously the much more error-prone does work, but then the
> option.jsonf can't be used via template(name="JSON" type="list"
> option.jsonf="on") any more:
>
> constant(value="\",\"timestamp\":")
> property(name="timegenerated" dateformat="unixtimestamp")
> constant(value=",\...

In case others look for this in future, I added this to
https://github.com/rsyslog/rsyslog/issues/2827 which seems to cover a
broader range of JSON-related formatting concerns.

A+
Dave
_______________________________________________
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.