Skip to content

Conversation

gaobinlong
Copy link
Contributor

@gaobinlong gaobinlong commented Jul 21, 2025

Description

Add an option capture_all_matches for the grok ingest processor, when set to true, all matched values for same field name will be collected into an array, by default, only the first the matched value will be captured.

By checking the code:

return; // Capture only the first value.
, found that maybe the current behavior is by design, but I also checked other ingestion tool like Logstash, it captures all matched values by default, so I think we can let the users decide the behavior by adding an extra option.

Related Issues

#18790

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@gaobinlong gaobinlong requested a review from a team as a code owner July 21, 2025 02:42
Signed-off-by: Binlong Gao <[email protected]>
Copy link
Contributor

✅ Gradle check result for 6b39893: SUCCESS

Copy link

codecov bot commented Jul 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.96%. Comparing base (1ca590a) to head (b6f29e8).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main   #18799   +/-   ##
=========================================
  Coverage     72.95%   72.96%           
- Complexity    69804    69816   +12     
=========================================
  Files          5667     5667           
  Lines        320532   320582   +50     
  Branches      46397    46405    +8     
=========================================
+ Hits         233847   233914   +67     
+ Misses        67768    67706   -62     
- Partials      18917    18962   +45     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@varunbharadwaj varunbharadwaj left a comment

Choose a reason for hiding this comment

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

Looks good to me. We call it capture_all_matches, but if we have a pattern matching multiple groups (for example word1,word2,word3, with pattern (%{WORD:word},)+), it looks like we only retrieve word3. We could highlight this in the docs later on.

@opensearch-trigger-bot
Copy link
Contributor

This PR is stalled because it has been open for 30 days with no activity.

@opensearch-trigger-bot opensearch-trigger-bot bot added the stalled Issues that have stalled label Sep 12, 2025
Copy link
Contributor

✅ Gradle check result for b6f29e8: SUCCESS

@andrross andrross merged commit 53dc1ea into opensearch-project:main Sep 12, 2025
37 of 39 checks passed
jainankitk pushed a commit to jainankitk/OpenSearch that referenced this pull request Sep 22, 2025
…opensearch-project#18799)

* Grok processor supports capturing multiple values for same field name

Signed-off-by: Binlong Gao <[email protected]>

* Modify change log

Signed-off-by: Binlong Gao <[email protected]>

---------

Signed-off-by: Binlong Gao <[email protected]>
Signed-off-by: Andrew Ross <[email protected]>
Co-authored-by: Andrew Ross <[email protected]>
jainankitk pushed a commit to jainankitk/OpenSearch that referenced this pull request Sep 22, 2025
…opensearch-project#18799)

* Grok processor supports capturing multiple values for same field name

Signed-off-by: Binlong Gao <[email protected]>

* Modify change log

Signed-off-by: Binlong Gao <[email protected]>

---------

Signed-off-by: Binlong Gao <[email protected]>
Signed-off-by: Andrew Ross <[email protected]>
Co-authored-by: Andrew Ross <[email protected]>
Signed-off-by: Ankit Jain <[email protected]>
jainankitk pushed a commit to jainankitk/OpenSearch that referenced this pull request Sep 22, 2025
…opensearch-project#18799)

* Grok processor supports capturing multiple values for same field name

Signed-off-by: Binlong Gao <[email protected]>

* Modify change log

Signed-off-by: Binlong Gao <[email protected]>

---------

Signed-off-by: Binlong Gao <[email protected]>
Signed-off-by: Andrew Ross <[email protected]>
Co-authored-by: Andrew Ross <[email protected]>
Signed-off-by: Ankit Jain <[email protected]>
asimmahmood1 pushed a commit to jainankitk/OpenSearch that referenced this pull request Sep 23, 2025
…opensearch-project#18799)

* Grok processor supports capturing multiple values for same field name

Signed-off-by: Binlong Gao <[email protected]>

* Modify change log

Signed-off-by: Binlong Gao <[email protected]>

---------

Signed-off-by: Binlong Gao <[email protected]>
Signed-off-by: Andrew Ross <[email protected]>
Co-authored-by: Andrew Ross <[email protected]>
pranikum pushed a commit to pranikum/OpenSearch that referenced this pull request Sep 23, 2025
…opensearch-project#18799)

* Grok processor supports capturing multiple values for same field name

Signed-off-by: Binlong Gao <[email protected]>

* Modify change log

Signed-off-by: Binlong Gao <[email protected]>

---------

Signed-off-by: Binlong Gao <[email protected]>
Signed-off-by: Andrew Ross <[email protected]>
Co-authored-by: Andrew Ross <[email protected]>
vinaykpud pushed a commit to vinaykpud/OpenSearch that referenced this pull request Sep 26, 2025
…opensearch-project#18799)

* Grok processor supports capturing multiple values for same field name

Signed-off-by: Binlong Gao <[email protected]>

* Modify change log

Signed-off-by: Binlong Gao <[email protected]>

---------

Signed-off-by: Binlong Gao <[email protected]>
Signed-off-by: Andrew Ross <[email protected]>
Co-authored-by: Andrew Ross <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stalled Issues that have stalled
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants