diff options
author | Milan Bartos <mbartos@redhat.com> | 2012-09-12 09:52:19 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-10-02 15:26:09 +0200 |
commit | 0faec9628301e1fd9c57e220d2ad5485e52ced2f (patch) | |
tree | 47b4eb670a59c68a30de70488cf0b5978727ab99 | |
parent | 17ed6cff3054bdd20ef71368f9f44f9062567056 (diff) | |
download | rsyslog-0faec9628301e1fd9c57e220d2ad5485e52ced2f.tar.gz rsyslog-0faec9628301e1fd9c57e220d2ad5485e52ced2f.tar.bz2 rsyslog-0faec9628301e1fd9c57e220d2ad5485e52ced2f.zip |
Change mmjsonparse so non-json messages doesn't get lost from ceelog
modified: mmjsonparse.c
-rw-r--r-- | plugins/mmjsonparse/mmjsonparse.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/mmjsonparse/mmjsonparse.c b/plugins/mmjsonparse/mmjsonparse.c index d419f246..0fc6a11c 100644 --- a/plugins/mmjsonparse/mmjsonparse.c +++ b/plugins/mmjsonparse/mmjsonparse.c @@ -149,6 +149,7 @@ BEGINdoAction msg_t *pMsg; uchar *buf; int bSuccess = 0; + struct json_object *jval; CODESTARTdoAction pMsg = (msg_t*) ppString[0]; /* note that we can performance-optimize the interface, but this also @@ -164,6 +165,14 @@ dbgprintf("mmjsonparse: msg is '%s'\n", buf); if(*buf == '\0' || strncmp((char*)buf, COOKIE, LEN_COOKIE)) { DBGPRINTF("mmjsonparse: no JSON cookie: '%s'\n", buf); + + /* create json if necessary and add buf as msg */ + if (!pMsg->json) { + pMsg->json = json_object_new_object(); + } + jval = json_object_new_string((char*)buf); + json_object_object_add(pMsg->json, "msg", jval); + FINALIZE; } buf += LEN_COOKIE; |