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

[x-pack][filebeat] incorporate LastModified into s3 event _id generation #42078

Merged
merged 16 commits into from
Dec 20, 2024

Conversation

stefans-elastic
Copy link
Contributor

@stefans-elastic stefans-elastic commented Dec 17, 2024

Proposed commit message

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.

Disruptive User Impact

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Closes #42040

Use cases

Screenshots

Screenshot 2024-12-17 at 6 03 46 PM

Logs

@stefans-elastic stefans-elastic added enhancement Team:Obs-InfraObs Label for the Observability Infrastructure Monitoring team labels Dec 17, 2024
@stefans-elastic stefans-elastic self-assigned this Dec 17, 2024
@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 Dec 17, 2024
Copy link
Contributor

mergify bot commented Dec 17, 2024

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @stefans-elastic? 🙏.
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 Dec 17, 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 Dec 17, 2024
@stefans-elastic stefans-elastic marked this pull request as ready for review December 17, 2024 10:40
@stefans-elastic stefans-elastic requested a review from a team as a code owner December 17, 2024 10:40
Copy link
Contributor

@tetianakravchenko tetianakravchenko left a comment

Choose a reason for hiding this comment

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

@stefans-elastic I think LastModified should be added to the debug log at https://github.com/elastic/beats/pull/42078/files#diff-f345fd6a1f5ea9523117d4ead2e5f1d13fb82eb1c65a089fd34fcdd514916a96R119, as now it is used for id

could you please also add a test for this change?

@tetianakravchenko tetianakravchenko requested a review from a team December 17, 2024 11:21
@stefans-elastic stefans-elastic requested a review from a team as a code owner December 17, 2024 15:11
CHANGELOG.next.asciidoc Outdated Show resolved Hide resolved
@@ -662,7 +663,7 @@ func Test_StorageClient(t *testing.T) {
if !tt.checkJSON {
val, err = got.Fields.GetValue("message")
assert.NoError(t, err)
assert.True(t, tt.expected[val.(string)])
assert.True(t, tt.expected[strings.ReplaceAll(val.(string), "\r", "")])
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need this change in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's because windows treating line breaks as \r\n instead of \n which results in tests failing on windows

Copy link
Contributor

mergify bot commented Dec 18, 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 aws-s3-id-change upstream/aws-s3-id-change
git merge upstream/main
git push upstream aws-s3-id-change

@stefans-elastic
Copy link
Contributor Author

Tests are passing now so I think this PR is ready for review

@tetianakravchenko
Copy link
Contributor

@stefans-elastic I see that you initially added unit test for this PR 3041ff4 but then reverted, is it intentional?

@stefans-elastic
Copy link
Contributor Author

@stefans-elastic I see that you initially added unit test for this PR 3041ff4 but then reverted, is it intentional?

the implementation has changed so the test wasn't correct anymore

@stefans-elastic
Copy link
Contributor Author

@stefans-elastic I see that you initially added unit test for this PR 3041ff4 but then reverted, is it intentional?

the implementation has changed so the test wasn't correct anymore

@tetianakravchenko I've added a new test

Copy link
Contributor

@tetianakravchenko tetianakravchenko left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

mergify bot commented Dec 19, 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 aws-s3-id-change upstream/aws-s3-id-change
git merge upstream/main
git push upstream aws-s3-id-change

@stefans-elastic stefans-elastic merged commit 58a5369 into elastic:main Dec 20, 2024
22 checks passed
@stefans-elastic stefans-elastic deleted the aws-s3-id-change branch December 20, 2024 09:56
mergify bot pushed a commit that referenced this pull request Dec 20, 2024
…ion (#42078)

* [x-pack][filebeat] incorporate LastModified into s3 event _id generation

* update PR id in changelog

* log LastModified value

* add unit test

* fix unit tests on windows

* use UnixMilli instead of time string

* change s3 event _id format

* fix changelog

* Update x-pack/filebeat/input/gcs/input_test.go

Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co>

* Update x-pack/filebeat/input/azureblobstorage/input_test.go

Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co>

* revert windows test fix

* add unit test

---------

Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co>
(cherry picked from commit 58a5369)

# Conflicts:
#	x-pack/filebeat/input/awss3/s3_objects.go
stefans-elastic added a commit that referenced this pull request Dec 23, 2024
…to s3 event _id generation (#42132)

* [x-pack][filebeat] incorporate LastModified into s3 event _id generation (#42078)

* [x-pack][filebeat] incorporate LastModified into s3 event _id generation

* update PR id in changelog

* log LastModified value

* add unit test

* fix unit tests on windows

* use UnixMilli instead of time string

* change s3 event _id format

* fix changelog

* Update x-pack/filebeat/input/gcs/input_test.go

Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co>

* Update x-pack/filebeat/input/azureblobstorage/input_test.go

Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co>

* revert windows test fix

* add unit test

---------

Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co>
(cherry picked from commit 58a5369)

# Conflicts:
#	x-pack/filebeat/input/awss3/s3_objects.go

* resolve conflicts

* linter fix

---------

Co-authored-by: stefans-elastic <stefan.stas@elastic.co>
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 enhancement Team:Obs-InfraObs Label for the Observability Infrastructure Monitoring team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Filebeat] aws-s3 input - incorporate Last-Modified time into _id
4 participants