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

Missing backup and delete for AWS S3 polling mode #41071

Merged
merged 3 commits into from
Oct 4, 2024

Conversation

kaiyan-sheng
Copy link
Contributor

@kaiyan-sheng kaiyan-sheng commented Oct 1, 2024

Proposed commit message

When running Filebeat s3 input polling mode, we suppose to have the options to backup s3 objects into a specific bucket and delete the object after backup.

filebeat.inputs:
- type: aws-s3
  enabled: true
  credential_profile_name: elastic-observability
  bucket_arn: arn:aws:s3:::test-s3-bucket-ks
  default_region: eu-central-1
  backup_to_bucket_arn: arn:aws:s3:::test-s3-bucket-ks-backup
  delete_after_backup: true
  number_of_workers: 5

With this config, objects/logs will be ingested from the bucket specified in bucket_arn into Elasticsearch just fine but no backup or delete happened.

This PR is add the feature back into S3 polling mode when user specifies a backup bucket and/or delete after backup.

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.

How to test this PR locally

With the same config, after adding this change, rebuild filebeat and we can see the new log log7 got ingested into Elasticsearch and after ingestion, this file is deleted from the test-s3-bucket-ks bucket and copied to test-s3-bucket-ks-backup bucket.
Screenshot 2024-10-01 at 4 44 42 PM

Related issues

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Oct 1, 2024
@kaiyan-sheng kaiyan-sheng self-assigned this Oct 1, 2024
Copy link
Contributor

mergify bot commented Oct 1, 2024

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

Copy link
Contributor

mergify bot commented Oct 1, 2024

backport-8.x has been added to help with the transition to the new branch 8.x.
If you don't need it please use backport-skip label and remove the backport-8.x label.

@mergify mergify bot added the backport-8.x Automated backport to the 8.x branch with mergify label Oct 1, 2024
@kaiyan-sheng kaiyan-sheng added backport-8.15 Automated backport to the 8.15 branch with mergify Team:Cloud-Monitoring Label for the Cloud Monitoring team labels Oct 2, 2024
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Oct 2, 2024
Copy link
Contributor

mergify bot commented Oct 2, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b s3_input_backup upstream/s3_input_backup
git merge upstream/main
git push upstream s3_input_backup

@kaiyan-sheng kaiyan-sheng marked this pull request as ready for review October 3, 2024 20:51
@kaiyan-sheng kaiyan-sheng requested a review from a team as a code owner October 3, 2024 20:51
@kaiyan-sheng kaiyan-sheng merged commit f47cbd6 into elastic:main Oct 4, 2024
22 checks passed
@kaiyan-sheng kaiyan-sheng deleted the s3_input_backup branch October 4, 2024 14:31
mergify bot pushed a commit that referenced this pull request Oct 4, 2024
mergify bot pushed a commit that referenced this pull request Oct 4, 2024
kaiyan-sheng added a commit that referenced this pull request Oct 7, 2024
…mode (#41122)

* Missing backup and delete for AWS S3 polling mode (#41071)

(cherry picked from commit f47cbd6)


---------

Co-authored-by: kaiyan-sheng <kaiyan.sheng@elastic.co>
kaiyan-sheng added a commit that referenced this pull request Oct 7, 2024
(cherry picked from commit f47cbd6)

Co-authored-by: kaiyan-sheng <kaiyan.sheng@elastic.co>
@lucabelluccini
Copy link
Contributor

Is there a test which would prevent this regression to occur again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify backport-8.15 Automated backport to the 8.15 branch with mergify Team:Cloud-Monitoring Label for the Cloud Monitoring team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[AWS] Filebeat s3 input polling mode does not backup to an S3 bucket
3 participants