[7.17](backport #30717) filebeat: ID for filestream is required#30996
Merged
[7.17](backport #30717) filebeat: ID for filestream is required#30996
Conversation
…30717) When a filestream input does not have an ID, we set the default .global ID at runtime and this ID is used to identify which files in the registry belong to each input. But if there are more than one input without an ID, then data is duplicated when Filebeat is restarted because the it's not possible to identify which input owns each file. We are adding a way to migrate those entries in the registry to the newly set ID. Ideally this will happen only once when the users update to this new version of Filebeat. They way we do it is by looking the registry for files that have their path matching the input but have the input ID as .global, those entries are then copied with the new key (which uses the input ID) so Filebeat can continue its operation without duplicating data. Most of the logic is the same of the already existing method UpdateIdentifiers from the sourceStore but for this PR it was also needed to update the in-memory store right away. Also borrowing from UpdateIdentifiers usage, this is done during the file prospector initialisation. Log errors are written when we detect filestream inputs without an ID or when more than one input is set with the same ID. Some files are refactored to pass the new linter, some test code also had some small refactoring. Co-authored-by: Craig MacKenzie <craig.mackenzie@elastic.co> (cherry picked from commit c61b219) # Conflicts: # .golangci.yml # dev-tools/templates/.golangci.yml # filebeat/docs/inputs/input-filestream-file-options.asciidoc # filebeat/input/filestream/internal/input-logfile/manager.go # filebeat/input/filestream/parsers_integration_test.go
|
This pull request doesn't have a |
Contributor
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
db05291 to
7a5211c
Compare
Contributor
7a5211c to
f69cab2
Compare
belimawr
approved these changes
Mar 24, 2022
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.
This is an automatic backport of pull request #30717 done by Mergify.
Cherry-pick of c61b219 has failed:
To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally
Mergify commands and options
More conditions and actions can be found in the documentation.
You can also trigger Mergify actions by commenting on this pull request:
@Mergifyio refreshwill re-evaluate the rules@Mergifyio rebasewill rebase this PR on its base branch@Mergifyio updatewill merge the base branch into this PR@Mergifyio backport <destination>will backport this PR on<destination>branchAdditionally, on Mergify dashboard you can:
Finally, you can contact us on https://mergify.com