-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[8.x](backport #41762) Use fingerprint
file identity by default and migrate file state from native
or path
#42126
Open
mergify
wants to merge
3
commits into
8.x
Choose a base branch
from
mergify/bp/8.x/pr-41762
base: 8.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
…m `native` or `path` (#41762) This commit changes the default `file_identity` from `native` to `fingerprint`, any previous state from `native` (or `path`) is automatically migrated to `fingerprint` whe Filestream is starting. The Filestream input has always had the [ability to update file identifiers](https://github.com/elastic/beats/blob/4278366ab03221e8b62183dc06f9505f6ccc5209/filebeat/input/filestream/prospector.go#L104-L122), however it never worked as expected, leading to full data duplication when changing the file identity. This commit fixes it to allow changing the file identity from `native` (inode + device ID) and `path` to `fingerprint` without any data duplication. (cherry picked from commit 78fe7a5) # Conflicts: # filebeat/tests/integration/filestream_test.go
mergify
bot
added
backport
conflicts
There is a conflict in the backported pull request
labels
Dec 19, 2024
mergify
bot
requested review from
belimawr and
faec
and removed request for
a team
December 19, 2024 19:12
Cherry-pick of 78fe7a5 has failed:
To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
botelastic
bot
added
the
needs_team
Indicates that the issue/PR needs a Team:* label
label
Dec 19, 2024
This pull request doesn't have a |
belimawr
force-pushed
the
mergify/bp/8.x/pr-41762
branch
from
December 19, 2024 22:15
d8c1b46
to
ef081b9
Compare
belimawr
approved these changes
Dec 19, 2024
This pull request has not been merged yet. Could you please review and merge it @belimawr? 🙏 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport
conflicts
There is a conflict in the backported pull request
needs_team
Indicates that the issue/PR needs a Team:* label
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.
Proposed commit message
This commit changes the default
file_identity
fromnative
tofingerprint
, any previous state fromnative
(orpath
) isautomatically migrated to
fingerprint
whe Filestream is starting.The Filestream input has always had the ability to update file identifiers,
however it never worked as expected, leading to full data duplication
when changing the file identity. This commit fixes it to allow
changing the file identity from
native
(inode + device ID) andpath
tofingerprint
without any data duplication.Checklist
I have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Disruptive User Impact
Because the
fingerprint
is the new default file identity, files are now only ingested when they reach at least 1024 bytes. The old default behaviour can be enabled by setting the file identity tonative
and disabling the fingerprint in the scanner.Author's Checklist
Regarding the Elastic-Agent integration tests, most tests actually use the
log
input because when they were written, Filestream was not available as an integration package. The very few other test that use Filestrem either generate a log file large enough or are skipped as flaky.How to test this PR locally
Create a log file with at least a few log lines and more than 1kb (e.g:
/tmp/flog.log
, 15 log lines), you can useflog
with Docker:Start Filebeat with the following configuration
filebeat.yml (native)
Wait until the file is fully ingested (wait for
End of file reached: /tmp/flog.log; Backoff now.
in the logs)Ensure all events have been published to the output (
wc -l ./output-file*
should return 15)Stop Filebeat
Change the file identity to
fingerprint
. It's the new default, hence it's not explicitly set.filebeat.yml (fingerprint)
Start Filebeat
Wait until the Filebeat "finds the end of the file" (wait for
End of file reached: /tmp/flog.log; Backoff now.
in the logs)Ensure no extra event was published ((
wc -l ./output-file*
should still return 15)Add 10 more lines to the file:
Wait until the new lines are ingested (wait for
End of file reached: /tmp/flog.log; Backoff now.
in the logs)Ensure all events have been published to the output with no duplication (
wc -l ./output-file*
should return 25)Related issues
Use cases
Dealing with identity reuse (e.g: inode reuse) without facing re-ingestion of data with Filestream input
## ScreenshotsLogs
This is an automatic backport of pull request #41762 done by [Mergify](https://mergify.com).