diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-09-19 14:19:55 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-09-19 14:19:55 +0200 |
commit | 708b695283687eb2571e6cc48c9ccb0bc30f9711 (patch) | |
tree | 44326d07a0c985a7c32e3645a007e90528c28c79 /runtime/msg.c | |
parent | 322b646204c970b1cb77e94c150726178f1cee19 (diff) | |
download | rsyslog-708b695283687eb2571e6cc48c9ccb0bc30f9711.tar.gz rsyslog-708b695283687eb2571e6cc48c9ccb0bc30f9711.tar.bz2 rsyslog-708b695283687eb2571e6cc48c9ccb0bc30f9711.zip |
Implement ability for CEE-based properties to be stored in disk queues
Diffstat (limited to 'runtime/msg.c')
-rw-r--r-- | runtime/msg.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index 1ec93d9e..d3c814e2 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -1090,6 +1090,10 @@ static rsRetVal MsgSerialize(msg_t *pThis, strm_t *pStrm) CHKiRet(obj.SerializeProp(pStrm, UCHAR_CONSTANT("pszRcvFrom"), PROPTYPE_PSZ, (void*) psz)); psz = getRcvFromIP(pThis); CHKiRet(obj.SerializeProp(pStrm, UCHAR_CONSTANT("pszRcvFromIP"), PROPTYPE_PSZ, (void*) psz)); + if(pThis->json != NULL) { + psz = (uchar*) json_object_get_string(pThis->json); + CHKiRet(obj.SerializeProp(pStrm, UCHAR_CONSTANT("json"), PROPTYPE_PSZ, (void*) psz)); + } objSerializePTR(pStrm, pCSStrucData, CSTR); objSerializePTR(pStrm, pCSAPPNAME, CSTR); @@ -3562,6 +3566,8 @@ rsRetVal MsgSetProperty(msg_t *pThis, var_t *pProp) prop_t *myProp; prop_t *propRcvFrom = NULL; prop_t *propRcvFromIP = NULL; + struct json_tokener *tokener; + struct json_object *json; DEFiRet; ISOBJ_TYPE_assert(pThis, msg); @@ -3616,6 +3622,12 @@ rsRetVal MsgSetProperty(msg_t *pThis, var_t *pProp) MsgSetRulesetByName(pThis, pProp->val.pStr); } else if(isProp("pszMSG")) { dbgprintf("no longer supported property pszMSG silently ignored\n"); + } else if(isProp("json")) { + tokener = json_tokener_new(); + json = json_tokener_parse_ex(tokener, (char*)rsCStrGetSzStrNoNULL(pProp->val.pStr), + cstrLen(pProp->val.pStr)); + json_tokener_free(tokener); + msgAddJSON(pThis, (uchar*)"!", json); } else { dbgprintf("unknown supported property '%s' silently ignored\n", rsCStrGetSzStrNoNULL(pProp->pcsName)); |