Update select_jsonpath to accept strings of JSON in addition to JsonNode objects#17683
Merged
Conversation
…ly-works-in-same-rule-where-parse_json-was-used
danotorrey
approved these changes
Dec 14, 2023
Contributor
There was a problem hiding this comment.
This works great and adds really nice flexibility! Well done @ryan-carroll-graylog!
kingzacko1
reviewed
Dec 15, 2023
kingzacko1
approved these changes
Dec 15, 2023
kingzacko1
left a comment
Contributor
There was a problem hiding this comment.
Just fix the changelog issue and pulls but it all looks good!
Co-authored-by: Zack King <91903901+kingzacko1@users.noreply.github.com>
ryan-carroll-graylog
added a commit
that referenced
this pull request
Jan 10, 2024
…ode objects (#17683) * Update select_jsonpath to accept strings of JSON in addition to JsonNode objects * Add unit test * Add changelog entry * Update changelog with correct issue/pr Co-authored-by: Zack King <91903901+kingzacko1@users.noreply.github.com> --------- Co-authored-by: Zack King <91903901+kingzacko1@users.noreply.github.com>
ryan-carroll-graylog
added a commit
that referenced
this pull request
Jan 10, 2024
…ode objects (#17683) * Update select_jsonpath to accept strings of JSON in addition to JsonNode objects * Add unit test * Add changelog entry * Update changelog with correct issue/pr Co-authored-by: Zack King <91903901+kingzacko1@users.noreply.github.com> --------- Co-authored-by: Zack King <91903901+kingzacko1@users.noreply.github.com>
ryan-carroll-graylog
added a commit
that referenced
this pull request
Jan 11, 2024
* Update select_jsonpath to accept strings of JSON in addition to JsonNode objects (#17683) * Update select_jsonpath to accept strings of JSON in addition to JsonNode objects * Add unit test * Add changelog entry * Update changelog with correct issue/pr Co-authored-by: Zack King <91903901+kingzacko1@users.noreply.github.com> --------- Co-authored-by: Zack King <91903901+kingzacko1@users.noreply.github.com> * Add handling for json arrays in lookup_all pipeline function (#17820) * Add handling for json arrays in lookup_all pipeline function * Add changelog entry * Update failing tests * Revert unneeded non string functionality * Update changelog * Cleanup test --------- Co-authored-by: Zack King <91903901+kingzacko1@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Previously
select_jsonpathcould only be used with a parsedJsonNodeobject (e.g. the direct output ofparse_jsonwithin the same rule).This update allows the
select_jsonpathfunction to accept a JSON String as thejsonparameter as well.Closes: #17647
Motivation and Context
As it stands:
We can use
parse_jsonandselect_jsonpathto work with JSON, but currently, theselect_jsonpathfunction only works within the same rule whereparse_jsonwas originally used. If the output fromparse_jsonis saved as a field on the message,select_jsonpathcalls in subsequent rules on that field will fail.This update allows a saved JSON message field to be used as the
select_jsonpathjsonparameter.How Has This Been Tested?
Locally in dev environment and unit tests.
Screenshots (if appropriate):
Types of changes
Checklist: