-
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
[Filestream] migrate state from previous ID to current #42624
base: main
Are you sure you want to change the base?
[Filestream] migrate state from previous ID to current #42624
Conversation
This commit enables Filestream inputs to migrate file states from previous IDs to its current ID, this is done by adding a `previous_ids` entry to the input configuration. We look in the store for all states that match an active file with one of the previous IDs and migrate this state to the new ID. The migrated old states are marked for removal from the store.
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
if err != nil { | ||
t.Fatalf("cannot get absolute path for 'testdata': %s", err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[NIT | Consistency]
you could use require.NoError
// eofMsg := fmt.Sprintf("End of file reached: %s; Backoff now.", logFilepath) | ||
// filebeat.WaitForLogs(eofMsg, time.Second*10, "EOF was not reached") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leftover from a refactor or debug?
Proposed commit message
This commit enables Filestream inputs to migrate file states from previous IDs to its current ID, this is done by adding a
previous_ids
entry to the input configuration. We look in the store for all states that match an active file with one of the previous IDs and migrate this state to the new ID. The migrated old states are marked for removal from the store.Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Disruptive User Impact
Author's Checklist
How to test this PR locally
Run the tests
Manual test
Create a file with more than 1kb in size:
docker run -it --rm mingrammer/flog -f rfc5424 -n 15 > /tmp/flog.log
Run Filebeat with the following configuration:
filebeat.yml
Wait until the file is fully ingested (15 lines in the output file)
Stop Filebeat
Optionally, remove the logs, this will make the next steps easier.
rm -rf logs
Run Filebeat with the following configuration (note the change in
id
and the newprevious_ids
):filebeat.yml
Wait until Filebeat "read" the files to the end. Look for
End of file reached: /tmp/flog.log; Backoff now.
in the second execution logs.Ensure no new data was added to the output file
You can also look for log entries like:
Related issues
## Use cases## ScreenshotsLogs