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 handling for json arrays in lookup_all pipeline function #17820

Merged
merged 9 commits into from
Jan 5, 2024

Conversation

ryan-carroll-graylog
Copy link
Contributor

@ryan-carroll-graylog ryan-carroll-graylog commented Jan 2, 2024

Description

Add support for JSON nodes in lookup_all pipeline function.

Motivation and Context

When array elements are selected from the json_path pipeline function, the array will include Jackson JsonNode elements containing the actual object values within. When passed to the lookup_all pipeline function, the function will fail look up the values in the array due to the JSON objects. This fix converts the JsonNode values to native Java Objects to be used as keys in the lookup table.

Closes: https://github.com/Graylog2/graylog-plugin-enterprise/issues/6363

How Has This Been Tested?

Well-covered with unit tests and manual testing was performed. See PR unit tests for examples.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

Copy link
Contributor

@danotorrey danotorrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and tests successfully! Will we want to backport this as well?

@ryan-carroll-graylog
Copy link
Contributor Author

LGTM and tests successfully! Will we want to backport this as well?

Thanks Dan! Yeah that was my plan, to get it usable in Illuminate sooner.

@ryan-carroll-graylog ryan-carroll-graylog merged commit 6b25028 into master Jan 5, 2024
5 checks passed
@ryan-carroll-graylog ryan-carroll-graylog deleted the fix/lookup_all_json_path branch January 5, 2024 13:07
ryan-carroll-graylog added a commit that referenced this pull request Jan 10, 2024
* 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
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants