|
|
dc8c44 |
diff -up rsyslog-7.2.1/runtime/msg.c.orig rsyslog-7.2.1/runtime/msg.c
|
|
|
dc8c44 |
--- rsyslog-7.2.1/runtime/msg.c.orig 2012-10-29 11:33:30.000000000 +0100
|
|
|
dc8c44 |
+++ rsyslog-7.2.1/runtime/msg.c 2012-11-14 08:58:20.235584832 +0100
|
|
|
dc8c44 |
@@ -3752,6 +3752,22 @@
|
|
|
dc8c44 |
RETiRet;
|
|
|
dc8c44 |
}
|
|
|
dc8c44 |
|
|
|
dc8c44 |
+static rsRetVal
|
|
|
dc8c44 |
+jsonMergeNonOverwrite(struct json_object *existing, struct json_object *json)
|
|
|
dc8c44 |
+{
|
|
|
dc8c44 |
+ DEFiRet;
|
|
|
dc8c44 |
+ struct json_object_iter it;
|
|
|
dc8c44 |
+
|
|
|
dc8c44 |
+ json_object_object_foreachC(existing, it) {
|
|
|
dc8c44 |
+ json_object_object_add(json, it.key, json_object_get(it.val));
|
|
|
dc8c44 |
+ }
|
|
|
dc8c44 |
+
|
|
|
dc8c44 |
+ CHKiRet(jsonMerge(existing, json));
|
|
|
dc8c44 |
+
|
|
|
dc8c44 |
+finalize_it:
|
|
|
dc8c44 |
+ RETiRet;
|
|
|
dc8c44 |
+}
|
|
|
dc8c44 |
+
|
|
|
dc8c44 |
/* find a JSON structure element (field or container doesn't matter). */
|
|
|
dc8c44 |
rsRetVal
|
|
|
dc8c44 |
jsonFind(msg_t *pM, es_str_t *propName, struct json_object **jsonres)
|
|
|
dc8c44 |
@@ -3795,7 +3811,7 @@
|
|
|
dc8c44 |
if(pM->json == NULL)
|
|
|
dc8c44 |
pM->json = json;
|
|
|
dc8c44 |
else
|
|
|
dc8c44 |
- CHKiRet(jsonMerge(pM->json, json));
|
|
|
dc8c44 |
+ CHKiRet(jsonMergeNonOverwrite(pM->json, json));
|
|
|
dc8c44 |
} else {
|
|
|
dc8c44 |
if(pM->json == NULL) {
|
|
|
dc8c44 |
/* now we need a root obj */
|
|
|
dc8c44 |
@@ -3808,7 +3824,7 @@
|
|
|
dc8c44 |
json_object_object_add(parent, (char*)leaf, json);
|
|
|
dc8c44 |
} else {
|
|
|
dc8c44 |
if(json_object_get_type(json) == json_type_object) {
|
|
|
dc8c44 |
- CHKiRet(jsonMerge(pM->json, json));
|
|
|
dc8c44 |
+ CHKiRet(jsonMergeNonOverwrite(pM->json, json));
|
|
|
dc8c44 |
} else {
|
|
|
dc8c44 |
//dbgprintf("AAAA: leafnode already exists, type is %d, update with %d\n", (int)json_object_get_type(leafnode), (int)json_object_get_type(json));
|
|
|
dc8c44 |
/* TODO: improve the code below, however, the current
|