Skip to content

[AWS] Skip s3 test events in s3-sqs filebeat input#47635

Merged
kaiyan-sheng merged 7 commits intomainfrom
s3_test_event
Nov 18, 2025
Merged

[AWS] Skip s3 test events in s3-sqs filebeat input#47635
kaiyan-sheng merged 7 commits intomainfrom
s3_test_event

Conversation

@kaiyan-sheng
Copy link
Contributor

@kaiyan-sheng kaiyan-sheng commented Nov 13, 2025

Proposed commit message

This PR adds support to automatically skip s3:TestEvent messages in the AWS S3 input. When Amazon S3 sends test notifications after configuring event notifications, these messages are now detected and silently skipped without generating errors or processing attempts.

problem

When configuring S3 event notifications, Amazon S3 sends a test message to verify the notification configuration. These test messages use a different format than regular S3 event notifications:

{
   "Service":"Amazon S3",
   "Event":"s3:TestEvent",
   "Time":"2014-10-13T15:57:02.089Z",
   "Bucket":"amzn-s3-demo-bucket",
   "RequestId":"5582815E1AEA5ADF",
   "HostId":"8cLeGAmw098X5cv4Zkwcmo8vvZa3eH3eKxsPzbB9wrR+YstdA6Knx4Ip8EXAMPLE"
}

Unlike regular S3 event notifications that use a Records array structure, test events use a simplified format with direct fields. Previously, the input would attempt to process these test events, which could lead to:

  • Unnecessary processing attempts
  • Potential error messages in logs
  • Confusion about missing Records fields

Solution

This PR adds a logic to identify and skip s3:TestEvent messages before any processing occurs. The solution handles test events in both direct S3→SQS and S3→SNS→SQS message flows.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works. Where relevant, I have used the stresstest.sh script to run them under stress conditions and race detector to verify their stability.
  • I have added an entry in ./changelog/fragments using the changelog tool.

Disruptive User Impact

N/A

Related issues

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Nov 13, 2025
@github-actions
Copy link
Contributor

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)
@kaiyan-sheng kaiyan-sheng added the Team:obs-ds-hosted-services Label for the Observability Hosted Services team label Nov 13, 2025
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Nov 13, 2025
@mergify
Copy link
Contributor

mergify bot commented Nov 13, 2025

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @kaiyan-sheng? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.
@kaiyan-sheng kaiyan-sheng added the backport-active-all Automated backport with mergify to all the active branches label Nov 13, 2025
@kaiyan-sheng kaiyan-sheng marked this pull request as ready for review November 14, 2025 15:42
@kaiyan-sheng kaiyan-sheng requested a review from a team as a code owner November 14, 2025 15:42
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ds-hosted-services (Team:obs-ds-hosted-services)

@kaiyan-sheng kaiyan-sheng requested a review from efd6 November 18, 2025 06:50
@kaiyan-sheng kaiyan-sheng requested a review from efd6 November 18, 2025 17:00
Copy link
Contributor

@efd6 efd6 left a comment

Choose a reason for hiding this comment

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

Thanks.

Copy link
Contributor

@Kavindu-Dodan Kavindu-Dodan 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 thanks for the improvement 🙌

@kaiyan-sheng kaiyan-sheng enabled auto-merge (squash) November 18, 2025 21:59
@kaiyan-sheng kaiyan-sheng merged commit a4e336c into main Nov 18, 2025
39 checks passed
@kaiyan-sheng kaiyan-sheng deleted the s3_test_event branch November 18, 2025 23:41
@github-actions
Copy link
Contributor

@Mergifyio backport 8.19 9.1 9.2

@mergify
Copy link
Contributor

mergify bot commented Nov 18, 2025

backport 8.19 9.1 9.2

✅ Backports have been created

Details
mergify bot pushed a commit that referenced this pull request Nov 18, 2025
* Skip s3 test events

* add changelog

* update changelog

* keep only event field in s3TestEvent

* add Event into s3EventsV2

* add comment and change variable name for processing s3-sns-sqs

(cherry picked from commit a4e336c)
mergify bot pushed a commit that referenced this pull request Nov 18, 2025
* Skip s3 test events

* add changelog

* update changelog

* keep only event field in s3TestEvent

* add Event into s3EventsV2

* add comment and change variable name for processing s3-sns-sqs

(cherry picked from commit a4e336c)
mergify bot pushed a commit that referenced this pull request Nov 18, 2025
* Skip s3 test events

* add changelog

* update changelog

* keep only event field in s3TestEvent

* add Event into s3EventsV2

* add comment and change variable name for processing s3-sns-sqs

(cherry picked from commit a4e336c)
kaiyan-sheng added a commit that referenced this pull request Nov 19, 2025
* Skip s3 test events

* add changelog

* update changelog

* keep only event field in s3TestEvent

* add Event into s3EventsV2

* add comment and change variable name for processing s3-sns-sqs

(cherry picked from commit a4e336c)

Co-authored-by: Kaiyan White <kaiyan.sheng@elastic.co>
kaiyan-sheng added a commit that referenced this pull request Nov 19, 2025
* Skip s3 test events

* add changelog

* update changelog

* keep only event field in s3TestEvent

* add Event into s3EventsV2

* add comment and change variable name for processing s3-sns-sqs

(cherry picked from commit a4e336c)

Co-authored-by: Kaiyan White <kaiyan.sheng@elastic.co>
kaiyan-sheng added a commit that referenced this pull request Nov 19, 2025
* Skip s3 test events

* add changelog

* update changelog

* keep only event field in s3TestEvent

* add Event into s3EventsV2

* add comment and change variable name for processing s3-sns-sqs

(cherry picked from commit a4e336c)

Co-authored-by: Kaiyan White <kaiyan.sheng@elastic.co>
andrzej-stencel pushed a commit to andrzej-stencel/beats that referenced this pull request Dec 1, 2025
* Skip s3 test events

* add changelog

* update changelog

* keep only event field in s3TestEvent

* add Event into s3EventsV2

* add comment and change variable name for processing s3-sns-sqs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-active-all Automated backport with mergify to all the active branches Team:obs-ds-hosted-services Label for the Observability Hosted Services team

4 participants