-
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
Log input: remove states more eagerly #25756
Conversation
The log input removes states on clean_removed by setting the TTL to 0, and wait for another scan to finally remove the state for the from the state registry. The total time window for a state removal thusly was `2*scan_frequency`. The disk scan always is subject to race conditions with the actual on disk state. In case of inode reuse an increased time window might might lead to filebeat detecting a new file as a rename of an old file. Next Filebeat truncate detection would try to handle the case, but if logs are written and rotated very fast the new file might already be bigger then the old file. The change introduced here more eagerly removes the state if clean_removed is set, reduing the time window of detection and state removal to `scan_frequency` in the log input.
Pinging @elastic/agent (Team:Agent) |
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪💚 Flaky test reportTests succeeded. Expand to view the summary
Test stats 🧪
|
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.
After a changelog entry is added, it is good to go.
This pull request is now in conflicts. Could you fix it? 🙏
|
## What does this PR do? The change introduced here more eagerly removes the state if clean_removed is set, reduing the time window of detection and state removal to `scan_frequency` in the log input. ## Why is it important? The log input removes states on clean_removed by setting the TTL to 0, and wait for another scan to finally remove the state for the from the state registry. The total time window for a state removal thusly was `2*scan_frequency`. The disk scan always is subject to race conditions with the actual on disk state. In case of inode reuse an increased time window might might lead to filebeat detecting a new file as a rename of an old file. Next Filebeat truncate detection would try to handle the case, but if logs are written and rotated very fast the new file might already be bigger then the old file. By removing the state more eagerly we reduce the risk of running into a race condition reopening a new file as old. (cherry picked from commit 2ee21d9)
## What does this PR do? The change introduced here more eagerly removes the state if clean_removed is set, reduing the time window of detection and state removal to `scan_frequency` in the log input. ## Why is it important? The log input removes states on clean_removed by setting the TTL to 0, and wait for another scan to finally remove the state for the from the state registry. The total time window for a state removal thusly was `2*scan_frequency`. The disk scan always is subject to race conditions with the actual on disk state. In case of inode reuse an increased time window might might lead to filebeat detecting a new file as a rename of an old file. Next Filebeat truncate detection would try to handle the case, but if logs are written and rotated very fast the new file might already be bigger then the old file. By removing the state more eagerly we reduce the risk of running into a race condition reopening a new file as old. (cherry picked from commit 2ee21d9) # Conflicts: # filebeat/input/log/input.go
## What does this PR do? The change introduced here more eagerly removes the state if clean_removed is set, reduing the time window of detection and state removal to `scan_frequency` in the log input. ## Why is it important? The log input removes states on clean_removed by setting the TTL to 0, and wait for another scan to finally remove the state for the from the state registry. The total time window for a state removal thusly was `2*scan_frequency`. The disk scan always is subject to race conditions with the actual on disk state. In case of inode reuse an increased time window might might lead to filebeat detecting a new file as a rename of an old file. Next Filebeat truncate detection would try to handle the case, but if logs are written and rotated very fast the new file might already be bigger then the old file. By removing the state more eagerly we reduce the risk of running into a race condition reopening a new file as old. (cherry picked from commit 2ee21d9)
Co-authored-by: Steffen Siering <steffen.siering@elastic.co>
What does this PR do?
The change introduced here more eagerly removes the state if
clean_removed is set, reduing the time window of detection and state
removal to
scan_frequency
in the log input.Why is it important?
The log input removes states on clean_removed by setting the TTL to 0, and wait for another scan to finally remove the state for the from the state registry. The total time window for a state removal thusly was
2*scan_frequency
. The disk scan always is subject to race conditions with the actual on disk state. In case of inode reuse an increased time window might might lead to filebeat detecting a new file as a rename of an old file. Next Filebeat truncate detection would try to handle the case, but if logs are written and rotated very fast the new file might already be bigger then the old file.By removing the state more eagerly we reduce the risk of running into a race condition reopening a new file as old.
Checklist
- [ ] 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 worksCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.