Fix silent event drop when a parser clears message content#52077
Merged
MichaelKatsoulis merged 8 commits intoJul 22, 2026
Merged
Conversation
Contributor
🤖 GitHub commentsJust comment with:
|
|
Pinging @elastic/obs-ds-hosted-services (Team:obs-ds-hosted-services) |
Contributor
|
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
…ichaelKatsoulis/beats into fix-awss3-readfile-drops-parser-fields
Kavindu-Dodan
left a comment
Contributor
There was a problem hiding this comment.
Left a nit - https://github.com/elastic/beats/pull/52077/changes#r3615467284
Otherwise LGTM
Kavindu-Dodan
approved these changes
Jul 20, 2026
MichaelKatsoulis
enabled auto-merge (squash)
July 22, 2026 09:22
Contributor
|
@Mergifyio backport 9.5 9.4 9.3 8.19 |
Contributor
✅ Backports have been createdDetails
|
This was referenced Jul 22, 2026
6 tasks
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.
Proposed commit message
Fix silent event drop when a parser clears message content
A parser can move the decoded data into the event fields and clear the
content, for example an ndjson parser configured without a message_key. When
such an object was read through the readFile path (any content-type other than
application/json or application/x-ndjson), the input dropped every event with
no error logged, because it only published when the message content was
non-empty. Events are now published when either the content or the fields are
populated.
The bug was first seen in as SDH affecting a customer.
The
aws-s3input picks a read path based on each object's Content-Type. Objects served asapplication/jsonandapplication/x-ndjsongo through a JSON reader that ignores the configured parsers, so the missingmessage_keynever mattered. Any othercontent-typeroutes the object through the generic file-reader path, which does run thendjsonparser.Stage 1: the parser doesn't drop anything. With no
message_key, the parser returns empty content plus the parsed JSON, and writes those parsed keys into the event's fields:decode() returns empty content when no message_key
the parsed JSON is written into the event fields
So at this point the data is fully intact. It's in
message.Fields, onlymessage.Contenthas been cleared.Stage 2: the event is dropped here. In the S3 file-reader loop, there is a guard that only checks whether
message.Contentis non-empty. Since the parser emptied Content, the whole block is skipped, eventCallback is never called, and the fields that hold the data are discarded with no log line:readFile only emits when len(message.Content) > 0
Checklist
stresstest.shscript to run them under stress conditions and race detector to verify their stability../changelog/fragmentsusing the changelog tool.Disruptive User Impact
No. They actually fix a bug!
How to test this PR locally
This reproduces the customer's case: an integration policy with an
ndjsonparser and no
message_key, reading S3 objects whoseContent-Typeis notapplication/json/application/x-ndjson(e.g.text/plain).Before the fix no events are ingested and nothing is logged while after the fix the events are ingested with the JSON
decoded into their fields.
Related issues
Use cases
Screenshots
Logs