summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2012-08-24 19:33:24 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2012-08-26 12:22:15 +0200
commit9068d7fa1e1ce57ab55838866ac58b060721193e (patch)
tree35cf56d6845242399b5e75de339c1a214f34c0f0
parente48728e80e6ce7b94319363581040774067de0fe (diff)
downloadrsyslog-9068d7fa1e1ce57ab55838866ac58b060721193e.zip
rsyslog-9068d7fa1e1ce57ab55838866ac58b060721193e.tar.gz
rsyslog-9068d7fa1e1ce57ab55838866ac58b060721193e.tar.xz
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>
-rw-r--r--runtime/msg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/msg.c b/runtime/msg.c
index 61c2f87..44d36fe 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);