Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a parameter skipempty to the json field type. #305

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nhosoi
Copy link

@nhosoi nhosoi commented Jul 27, 2018

If skipempty is set as follows, empty json objects are dropped from
the parsed result.
%field_name:json:skipempty%

If any parameter other than "skipempty" is given ("bogus" in this
example), an error message "invalid flag for JSON parser: bogus"
is issued.

Add test for the skipempty parameter.

If skipempty is set as follows, empty json objects are dropped from
the parsed result.
  %field_name:json:skipempty%

If any parameter other than "skipempty" is given ("bogus" in this
example), an error message "invalid flag for JSON parser: bogus"
is issued.

Add test for the skipempty parameter.
@richm
Copy link

richm commented Jul 27, 2018

Dependency on libfastjson needs to be updated to 0.99.8 or later to pick up rsyslog/libfastjson#155

[2018-07-27 18:33:32] [build] parser.c:2365:5: warning: implicit declaration of function ‘json_object_array_del_idx’; did you mean ‘json_object_array_get_idx’? [-Wimplicit-function-declaration]
[2018-07-27 18:33:32] [build]      json_object_array_del_idx(json, i--);
[2018-07-27 18:33:32] [build]      ^~~~~~~~~~~~~~~~~~~~~~~~~
[2018-07-27 18:33:32] [build]      json_object_array_get_idx
...
[2018-07-27 18:33:39] [build]   CCLD     lognormalizer
[2018-07-27 18:33:40] [build] ../src/.libs/liblognorm.so: undefined reference to `json_object_array_del_idx'

@nhosoi
Copy link
Author

nhosoi commented Mar 3, 2019

@rgerhards, sorry about this slow post.

I double-checked libfastjson and learned rsyslog/libfastjson#155 is merged to the master branch, but it's not in the tagged release. The latest libfastjson version is v0.99.8 which was released on Dec 18 2017 and 9 commits were merged to the master branch since then. pr/155 is one of them. Thus, this pr fails the tests even with the libfastjson v0.99.8... :( It requires new version of libfastjson including rsyslog/libfastjson#155.

Dependency on libfastjson needs to be updated to 0.99.8 or later to pick up rsyslog/libfastjson#155

Note: it's a bit tricky since libfastjson v0.99.8 contains this commit pr#155, which is different from what we'd like to have.

commit a500c1f0b5da18a4108e1844fc50fc2ed4c75a86
Merge: 9db3099 2f5789b
Author: Eric Haszlakiewicz <[email protected]>
Date:   Tue Mar 3 22:00:08 2015 -0500
    Merge pull request #155 from LeSpocky/bsearch
    add bsearch for arrays

Could there be a plan to release libfastjson 0.99.9 containing the 9 commits? And does this PR have a chance to be tested and merged? Thanks!

nhosoi added a commit to nhosoi/origin-aggregated-logging that referenced this pull request May 17, 2019
libfastjson - Adding "void fjson_object_array_del_idx(struct
 fjson_object *jso, int idx)", which deletes the idx-th element
 in the array type object.

 upstream PR: rsyslog/libfastjson#155

liblognorm - Adding a parameter skipempty to the json field type.
 If skipempty is set as follows, empty json objects are dropped
 from the parsed result.
  %field_name:json:skipempty%

 If any parameter other than "skipempty" is given ("bogus" in this
 example), an error message "invalid flag for JSON parser: bogus"
 is issued.

 Add test for the skipempty parameter.

 upstream PR: rsyslog/liblognorm#305
@Cropi
Copy link
Contributor

Cropi commented Jul 14, 2021

Hi, libfastjson has been rebased to 0.99.9 . Could you rerun the tests with the latest libfastjson?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants