Commit dbb8607529f188cf754115eedf5f33f3a687584f introduice a bug. Replacing
(uchar **)str[0] by (struct*)ptr remove a dereference.
Use *(struct **) instead of (struct *).
Some internal data elements are accessed, which is bad and no
longer possible with newer versions of libfastjson and is bad
style in any case (albeit "approved" by json-c).
closes https://github.com/rsyslog/rsyslog/issues/943
...and friends. This uses internals of the json library. It was
required when we used json-c, where distros often shipped versions
that did miss its clean counterpart. Now that we require
libfastjson, we can (and should) use the clean method.
closes https://github.com/rsyslog/rsyslog/issues/941
as we now use libfastjson, we do no longer need to check for "new"
features, as these are always present in libfastjson (things
like json_object_object_get_ex()).
closes https://github.com/rsyslog/rsyslog/issues/935
those starting at column 0 are temporary debug aids during development.
Some of them I intend to keep in for a version or two. Some of them
I tend to forget later. This is a cleanup of those. Most are removed,
some are promoted to be permanently there - now indicated by proper
indention.
Uses a json-c library (http://oss.metaparadigm.com/json-c/).
With this, a template
> $template MongoTemplate,"{%hostname:::jsonf:sys%, %$!all-json:2:$:%"
and action
> & action(type="ommongodb" db="ceelog" collection="local" template="MongoTemplate")
will store a record created by
> logger -d -u p/dev/log -p mail.info -t mymailer '@cee: {"false": false, "null": null, "true": true, "object": {"a":"a", "b":"b"}, "array": [1, 2, 3], "number1": 3, "number2": 3.14, "string": "String"}'
as
> { "_id" : ObjectId("5037bbfc97dd811374ce5a00"), "sys" : "kulicka", "false" : "false", "null" : "-", "true" : "true", "object.a" : "a", "object.b" : "b", "array.*" : "3", "number1" : "3", "number2" : "3.140000", "string" : "String" }
which is not great, but fair enough given the current design of
libee (the information loss manifests by the time of template processing,
ommongodb can't fix it).
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
The plugin now uses libmongo-client (which is configured using
pkg-config) instead of the 10gen client, so the instructions to copy
client source code no longer apply.