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

[filebeat][s3] Add custom parsing script for S3 notifications #28946

Merged
merged 8 commits into from
Nov 18, 2021

Conversation

marc-gr
Copy link
Contributor

@marc-gr marc-gr commented Nov 12, 2021

What does this PR do?

Adds the ability to define a custom parsing script to deal with non-standard S3 notifications received through SQS.
Improves error handling for malformed S3 notifications.

Why is it important?

In some scenarios the received SQS notification might be non-standard. This change lets the user define a custom parsing script to deal with them.

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
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Closes #28828

@marc-gr marc-gr added Team:Security-External Integrations backport-v8.0.0 Automated backport with mergify backport-v7.16.0 Automated backport with mergify labels Nov 12, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Nov 12, 2021
It can be used as a regular JS map since its only purpose is to be read.
@elasticmachine
Copy link
Collaborator

elasticmachine commented Nov 12, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-11-16T10:55:19.684+0000

  • Duration: 94 min 13 sec

  • Commit: d63893f

Test stats 🧪

Test Results
Failed 0
Passed 8063
Skipped 1201
Total 9264

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@leehinman
Copy link
Contributor

Do we have a use case where the notification received via SQS isn't JSON?

I'm just wondering if we need full JavaScript support or if greater flexibility in JSON parsing would be sufficient.

@marc-gr marc-gr requested a review from efd6 November 15, 2021 09:54
Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

Nice work! Now this input should be able to handle just about any notification format users throw at it.

@andrewkroh andrewkroh added the Team:Integrations Label for the Integrations team label Nov 18, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@marc-gr marc-gr merged commit df3fcec into elastic:master Nov 18, 2021
@marc-gr marc-gr deleted the awss3-support-sns branch November 18, 2021 08:27
mergify bot pushed a commit that referenced this pull request Nov 18, 2021
* Add custom parsing script for S3 notifications

* Remove unnecessary custom jsmapstr type.
It can be used as a regular JS map since its only purpose is to be read.

* add docs and changelog entry

* Remove commented code

* Document script options restriction

* Better error if Records are missing in notification

* Fix test

* Pass notification as string and add xml parsing options for the scripts

(cherry picked from commit df3fcec)
mergify bot pushed a commit that referenced this pull request Nov 18, 2021
* Add custom parsing script for S3 notifications

* Remove unnecessary custom jsmapstr type.
It can be used as a regular JS map since its only purpose is to be read.

* add docs and changelog entry

* Remove commented code

* Document script options restriction

* Better error if Records are missing in notification

* Fix test

* Pass notification as string and add xml parsing options for the scripts

(cherry picked from commit df3fcec)
marc-gr added a commit that referenced this pull request Nov 18, 2021
#29027)

* Add custom parsing script for S3 notifications

* Remove unnecessary custom jsmapstr type.
It can be used as a regular JS map since its only purpose is to be read.

* add docs and changelog entry

* Remove commented code

* Document script options restriction

* Better error if Records are missing in notification

* Fix test

* Pass notification as string and add xml parsing options for the scripts

(cherry picked from commit df3fcec)

Co-authored-by: Marc Guasch <marc-gr@users.noreply.github.com>
marc-gr added a commit that referenced this pull request Nov 18, 2021
…S3 notifications (#29026)

* [filebeat][s3] Add custom parsing script for S3 notifications (#28946)

* Add custom parsing script for S3 notifications

* Remove unnecessary custom jsmapstr type.
It can be used as a regular JS map since its only purpose is to be read.

* add docs and changelog entry

* Remove commented code

* Document script options restriction

* Better error if Records are missing in notification

* Fix test

* Pass notification as string and add xml parsing options for the scripts

(cherry picked from commit df3fcec)

* Remove Provider field not present in branch

Co-authored-by: Marc Guasch <marc-gr@users.noreply.github.com>
Co-authored-by: Marc Guasch <marc.guasch@elastic.co>
@rstatsinger rstatsinger requested review from rstatsinger and removed request for rstatsinger November 22, 2021 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v7.16.0 Automated backport with mergify backport-v8.0.0 Automated backport with mergify Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Filebeat] aws-s3 - Add validation of S3 Event Notification JSON received from SQS
5 participants