rsyslog/tests/template-const-jsonf.sh
Rainer Gerhards 93bebb1f1f template: add option to generate json "container"
This enables easy JSON generation via template.

This commit also corrects an issue with the constant "jsonf"
format. That was recently added, and the implementation problem
only became visible when used inside a larger json object. No
officially released code is affected, thought - so it rellay
is just a side-note.

closes https://github.com/rsyslog/rsyslog/issues/2347
2018-02-16 08:22:49 +01:00

19 lines
551 B
Bash
Executable File

#!/bin/bash
# added 2018-02-10 by Rainer Gerhards; Released under ASL 2.0
. $srcdir/diag.sh init
. $srcdir/diag.sh generate-conf
. $srcdir/diag.sh add-conf '
template(name="outfmt" type="list") {
constant(outname="@version" value="1" format="jsonf")
constant(value="\n")
}
local4.* action(type="omfile" file="rsyslog.out.log" template="outfmt")
'
. $srcdir/diag.sh startup
. $srcdir/diag.sh injectmsg 0 1
. $srcdir/diag.sh shutdown-when-empty
. $srcdir/diag.sh wait-shutdown
. $srcdir/diag.sh content-cmp '"@version": "1"'
. $srcdir/diag.sh exit