-
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
Fix loop while reading from standalone evtx #30006
Conversation
When we reach the end of the file (case io.EOF) we set stop = true. But next we continue look regardless stop value and read whole file again and again
Fix loop while reading from standalone evtx
This pull request does not have a backport label. Could you fix it @grishinpv? 🙏
NOTE: |
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
💚 Flaky test reportTests succeeded. 🤖 GitHub commentsTo re-run your PR in the CI, just comment with:
|
Pinging @elastic/siem (Team:SIEM) |
Have you followed the instructions in https://www.elastic.co/guide/en/beats/winlogbeat/7.7/reading-from-evtx.html#reading-from-evtx? Specifically the part about |
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
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.
This appears to be the same issue as reported here: https://discuss.elastic.co/t/winlogbeat-wont-exit-winlogbeat-json-output-size-is-different-for-same-file/295706
I did test out the original fix and it does work, but as my other comment points out, there's an edge case that's missed when there are records returned, along with an io.EOF
.
Commenting to track the bug. I was the one who posted on the forum earlier. Let me know if you need any help, I have moderate experience working with Golang. |
Hi @grishinpv, do you have an update on the status of your change? If you would like, I can push the necessary changes and get this PR merged. If you do push a change, we'll also need an update to --- a/CHANGELOG.next.asciidoc
+++ b/CHANGELOG.next.asciidoc
@@ -84,6 +84,7 @@
- Improve ECS field mappings in Sysmon module. `rule.name` is populated for all events when present. {issue}18364[18364]
- Remove top level `hash` property from sysmon events {pull}20653[20653]
- Move module processing from local Javascript processor to ingest node {issue}29184[29184] {pull}29435[29435]
+- Fix run loop when reading from evtx file {pull}30006[30006]
*Functionbeat* If I don't hear back in the next day or so, I'll go ahead and push the changes so we can get this fix in. |
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.
LGTM
/test |
- Fix loop while reading from standalone evtx file - Moved stop variable and check to outer loop Co-authored-by: Taylor Swanson <[email protected]> (cherry picked from commit 3c6724a)
- Fix loop while reading from standalone evtx file - Moved stop variable and check to outer loop Co-authored-by: Taylor Swanson <[email protected]> (cherry picked from commit 3c6724a)
- Fix loop while reading from standalone evtx file - Moved stop variable and check to outer loop Co-authored-by: Taylor Swanson <[email protected]> (cherry picked from commit 3c6724a)
- Fix loop while reading from standalone evtx file - Moved stop variable and check to outer loop Co-authored-by: Taylor Swanson <[email protected]> (cherry picked from commit 3c6724a) Co-authored-by: Grishin Pavel <[email protected]>
- Fix loop while reading from standalone evtx file - Moved stop variable and check to outer loop Co-authored-by: Taylor Swanson <[email protected]> (cherry picked from commit 3c6724a) Co-authored-by: Grishin Pavel <[email protected]>
…30188) * Fix loop while reading from standalone evtx (#30006) - Fix loop while reading from standalone evtx file - Moved stop variable and check to outer loop Co-authored-by: Taylor Swanson <[email protected]> (cherry picked from commit 3c6724a)
Still not working on Winlogbeat 8.0.0 Windows x86_64. Behavior is as before as explained in https://discuss.elastic.co/t/winlogbeat-wont-exit-winlogbeat-json-output-size-is-different-for-same-file/295706. |
What does this PR do?
Tjis fix adds checking EOF to prevent constant loop while reading standalone evtx file
Why is it important?
When we reach the end of the file (case io.EOF) we set stop = true.
But next we continue the loop regardless stop value and read whole file again and again.
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.