diff options
author | Miloslav Trmač <mitr@redhat.com> | 2012-08-24 19:33:24 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-08-26 12:22:15 +0200 |
commit | 9068d7fa1e1ce57ab55838866ac58b060721193e (patch) | |
tree | 35cf56d6845242399b5e75de339c1a214f34c0f0 /runtime | |
parent | e48728e80e6ce7b94319363581040774067de0fe (diff) | |
download | rsyslog-9068d7fa1e1ce57ab55838866ac58b060721193e.tar.gz rsyslog-9068d7fa1e1ce57ab55838866ac58b060721193e.tar.xz rsyslog-9068d7fa1e1ce57ab55838866ac58b060721193e.zip |
INCOMPATIBLE: Return {} for missing $!all-json
%$!all-json% will return a {}-wrapped object if there are are any
events, or when there is an attached (empty) pMsg->event, but an empty
string if nothing is attached. Let it return an empty object "{}" in
that case for consistency. In particular, this allows
$template MongoTemplate,"{%hostname:::jsonf:sys%, %$!all-json:2:$:%"
to always result in a valid JSON.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/msg.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index 61c2f87b..44d36fef 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -2734,7 +2734,7 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, if(pMsg->event == NULL) { if(*pbMustBeFreed == 1) free(pRes); - pRes = (uchar*) ""; + pRes = (uchar*) "{}"; *pbMustBeFreed = 0; } else { ee_fmtEventToJSON(pMsg->event, &str); |