-
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
[winlogbeat] Retry EvtSubscribe from start if fails with strict mode #30155
Conversation
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
@andrewkroh the retry is performed automatically in this first approach. Do you think adding a way to enable or disable this behavior at will would be preferred? |
That looks pretty simple so perhaps it does not need to be configurable. Can you create an integration test with windows that exercises this path. One idea I have is to read from a test log we create during the tests, modify the bookmark we have to move the read index forward such that it becomes an invalid bookmark, then try to read using the bookmark, verify it starts at the beginning. |
Based on #30201 I think another test case for this should be reading from a channel, deleting the channel, then recreating the channel and read from it again with the previously saved bookmark. I think that's a realistic scenario that is happening to users based on that report. |
Let me know if I should create a new issue but have you ever noticed that Winlogbeat can't read from the SysMon channel when SysMon is recently installed or when the configuration changes? A restart of the winlogbeat service is needed when making changes to SysMon. It's been many versions since I tested this but I will report back if that's still happening. The only way we could successfully deploy 9k+ winlogbeat agents and SysMon was to install sysmon first then winlogbeat. Then any changes to SysMon would require us to restart winlogbeat so we can gather events as soon as possible. |
0543feb
to
72689d0
Compare
/test |
72689d0
to
3eed307
Compare
Can you fix this message please.
And I wonder if your test is failing because the path name is too long? Trying shortening the test name.
|
3eed307
to
b1eedbd
Compare
b1eedbd
to
e7dd4df
Compare
Co-authored-by: Andrew Kroh <[email protected]>
One of the format strings was ignored, resulting in invalid YaML
/test |
…30155) * Retry EvtSubscribe from start if fails with strict mode * Add metrics and tests * Shorten test name * Fix debug message * Update winlogbeat/beater/winlogbeat.go Co-authored-by: Andrew Kroh <[email protected]> * Shorten test names * Add changelog * Shorten bad bookmark test * Close file on test * restructure test * Fix fake bookmark generation in test One of the format strings was ignored, resulting in invalid YaML * Additional logging * Fix linting issues * Fix linting issue * Remove test output * Fix usage of fmt.Errorf Co-authored-by: Andrew Kroh <[email protected]> Co-authored-by: Adrian Serrano <[email protected]> (cherry picked from commit e8a4675)
…30155) * Retry EvtSubscribe from start if fails with strict mode * Add metrics and tests * Shorten test name * Fix debug message * Update winlogbeat/beater/winlogbeat.go Co-authored-by: Andrew Kroh <[email protected]> * Shorten test names * Add changelog * Shorten bad bookmark test * Close file on test * restructure test * Fix fake bookmark generation in test One of the format strings was ignored, resulting in invalid YaML * Additional logging * Fix linting issues * Fix linting issue * Remove test output * Fix usage of fmt.Errorf Co-authored-by: Andrew Kroh <[email protected]> Co-authored-by: Adrian Serrano <[email protected]> (cherry picked from commit e8a4675)
…30155) * Retry EvtSubscribe from start if fails with strict mode * Add metrics and tests * Shorten test name * Fix debug message * Update winlogbeat/beater/winlogbeat.go Co-authored-by: Andrew Kroh <[email protected]> * Shorten test names * Add changelog * Shorten bad bookmark test * Close file on test * restructure test * Fix fake bookmark generation in test One of the format strings was ignored, resulting in invalid YaML * Additional logging * Fix linting issues * Fix linting issue * Remove test output * Fix usage of fmt.Errorf Co-authored-by: Andrew Kroh <[email protected]> Co-authored-by: Adrian Serrano <[email protected]> (cherry picked from commit e8a4675)
…fails with strict mode (#31043) * [winlogbeat] Retry EvtSubscribe from start if fails with strict mode (#30155) * Retry EvtSubscribe from start if fails with strict mode * Add metrics and tests * Shorten test name * Fix debug message * Update winlogbeat/beater/winlogbeat.go Co-authored-by: Andrew Kroh <[email protected]> * Shorten test names * Add changelog * Shorten bad bookmark test * Close file on test * restructure test * Fix fake bookmark generation in test One of the format strings was ignored, resulting in invalid YaML * Additional logging * Fix linting issues * Fix linting issue * Remove test output * Fix usage of fmt.Errorf Co-authored-by: Andrew Kroh <[email protected]> Co-authored-by: Adrian Serrano <[email protected]> (cherry picked from commit e8a4675) * Update CHANGELOG.next.asciidoc Co-authored-by: Marc Guasch <[email protected]>
…fails with strict mode (#31044) * [winlogbeat] Retry EvtSubscribe from start if fails with strict mode (#30155) * Retry EvtSubscribe from start if fails with strict mode * Add metrics and tests * Shorten test name * Fix debug message * Update winlogbeat/beater/winlogbeat.go Co-authored-by: Andrew Kroh <[email protected]> * Shorten test names * Add changelog * Shorten bad bookmark test * Close file on test * restructure test * Fix fake bookmark generation in test One of the format strings was ignored, resulting in invalid YaML * Additional logging * Fix linting issues * Fix linting issue * Remove test output * Fix usage of fmt.Errorf Co-authored-by: Andrew Kroh <[email protected]> Co-authored-by: Adrian Serrano <[email protected]> (cherry picked from commit e8a4675) * Update CHANGELOG.next.asciidoc Co-authored-by: Marc Guasch <[email protected]>
…lastic#30155) * Retry EvtSubscribe from start if fails with strict mode * Add metrics and tests * Shorten test name * Fix debug message * Update winlogbeat/beater/winlogbeat.go Co-authored-by: Andrew Kroh <[email protected]> * Shorten test names * Add changelog * Shorten bad bookmark test * Close file on test * restructure test * Fix fake bookmark generation in test One of the format strings was ignored, resulting in invalid YaML * Additional logging * Fix linting issues * Fix linting issue * Remove test output * Fix usage of fmt.Errorf Co-authored-by: Andrew Kroh <[email protected]> Co-authored-by: Adrian Serrano <[email protected]>
… fails with strict mode (#31042) * [winlogbeat] Retry EvtSubscribe from start if fails with strict mode (#30155) * Retry EvtSubscribe from start if fails with strict mode * Add metrics and tests * Shorten test name * Fix debug message * Update winlogbeat/beater/winlogbeat.go Co-authored-by: Andrew Kroh <[email protected]> * Shorten test names * Add changelog * Shorten bad bookmark test * Close file on test * restructure test * Fix fake bookmark generation in test One of the format strings was ignored, resulting in invalid YaML * Additional logging * Fix linting issues * Fix linting issue * Remove test output * Fix usage of fmt.Errorf Co-authored-by: Andrew Kroh <[email protected]> Co-authored-by: Adrian Serrano <[email protected]> (cherry picked from commit e8a4675) * Update CHANGELOG.next.asciidoc * Fix unlink statements Co-authored-by: Marc Guasch <[email protected]> Co-authored-by: Marc Guasch <[email protected]>
…lastic#30155) * Retry EvtSubscribe from start if fails with strict mode * Add metrics and tests * Shorten test name * Fix debug message * Update winlogbeat/beater/winlogbeat.go Co-authored-by: Andrew Kroh <[email protected]> * Shorten test names * Add changelog * Shorten bad bookmark test * Close file on test * restructure test * Fix fake bookmark generation in test One of the format strings was ignored, resulting in invalid YaML * Additional logging * Fix linting issues * Fix linting issue * Remove test output * Fix usage of fmt.Errorf Co-authored-by: Andrew Kroh <[email protected]> Co-authored-by: Adrian Serrano <[email protected]>
…art if fails with strict mode (elastic#31043) * [winlogbeat] Retry EvtSubscribe from start if fails with strict mode (elastic#30155) * Retry EvtSubscribe from start if fails with strict mode * Add metrics and tests * Shorten test name * Fix debug message * Update winlogbeat/beater/winlogbeat.go Co-authored-by: Andrew Kroh <[email protected]> * Shorten test names * Add changelog * Shorten bad bookmark test * Close file on test * restructure test * Fix fake bookmark generation in test One of the format strings was ignored, resulting in invalid YaML * Additional logging * Fix linting issues * Fix linting issue * Remove test output * Fix usage of fmt.Errorf Co-authored-by: Andrew Kroh <[email protected]> Co-authored-by: Adrian Serrano <[email protected]> (cherry picked from commit 6b75bc6) * Update CHANGELOG.next.asciidoc Co-authored-by: Marc Guasch <[email protected]>
…30155) * Retry EvtSubscribe from start if fails with strict mode * Add metrics and tests * Shorten test name * Fix debug message * Update winlogbeat/beater/winlogbeat.go Co-authored-by: Andrew Kroh <[email protected]> * Shorten test names * Add changelog * Shorten bad bookmark test * Close file on test * restructure test * Fix fake bookmark generation in test One of the format strings was ignored, resulting in invalid YaML * Additional logging * Fix linting issues * Fix linting issue * Remove test output * Fix usage of fmt.Errorf Co-authored-by: Andrew Kroh <[email protected]> Co-authored-by: Adrian Serrano <[email protected]>
What does this PR do?
Creates a subscription to the winlog channel using
EvtSubscribeStrict
flag to be able to notice when a bookmark ran invalid. In that scenario we retry the subscription from the beginning of the channel.Why is it important?
Based on #29793 there is the suspicion that under some scenarios winlogbeat might be ignoring some events when an invalid bookmark is used.
Checklist
- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Related issues