-
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] Add support for custom XML queries #29330
Conversation
- Added new configuration field (xml_query) to support custom XML queries - This new configuration item will conflict with existing simple query configuration items (ignore_older, event_id, level, provider) - Validator has been updated to check for key conflicts and XML syntax, but does not check for correctness of XML schema.
This pull request does not have a backport label. Could you fix it @taylor-swanson? 🙏
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:
|
/test |
run elasticsearch-ci/docs |
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 part looks good. Can you please add some tests for this. We should have something added to the system tests (https://github.com/elastic/beats/blob/master/winlogbeat/tests/system/test_wineventlog.py) and I imagine there's a Go test that can be added that using xml_query. And a config validation test to check the assertions on the config.
There's a wineventlog-experimental reader that I expect needs to be updated as well. Check https://github.com/elastic/beats/blob/master/winlogbeat/eventlog/wineventlog_experimental.go#L47.
Per event log reader rather than "channel" is how I would describe it.
record_number is legacy. It was kept to help users migrating from an older version of the registry file that did not contain bookmark. That was a very long time ago so that field and the associated logic could be removed now. |
- Removed redundant ID assignment - Modified wineventlog_experimental to support custom XML queries - Added unit tests for config validation - Added unit/system test for XML query runner
queryLog := c.Name | ||
if info, err := os.Stat(c.Name); err == nil && info.Mode().IsRegular() { |
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.
I know that this is pre-existing, but is it ever likely that a user will specify a file log destination with a file scheme?
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.
I'm not entirely sure, perhaps someone else can elaborate on that more (@andrewkroh ?). We do support providing a filename and reading from it, that much I do know.
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.
In the docs we say they need to pass an absolute path so I don't think users will pass a file URI.
To read events from an archived .evtx file you can specify the name as the absolute path (it cannot be relative) to the file.
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
- Added new configuration field (xml_query) to support custom XML queries - This new configuration item will conflict with existing simple query configuration items (ignore_older, event_id, level, provider) - Validator has been updated to check for key conflicts and XML syntax, but does not check for correctness of XML schema. - Added unit tests for config validation - Added unit/system test for XML query runner (cherry picked from commit b5e9414)
- Added new configuration field (xml_query) to support custom XML queries - This new configuration item will conflict with existing simple query configuration items (ignore_older, event_id, level, provider) - Validator has been updated to check for key conflicts and XML syntax, but does not check for correctness of XML schema. - Added unit tests for config validation - Added unit/system test for XML query runner (cherry picked from commit b5e9414)
- Added new configuration field (xml_query) to support custom XML queries - This new configuration item will conflict with existing simple query configuration items (ignore_older, event_id, level, provider) - Validator has been updated to check for key conflicts and XML syntax, but does not check for correctness of XML schema. - Added unit tests for config validation - Added unit/system test for XML query runner (cherry picked from commit b5e9414) Co-authored-by: Taylor Swanson <[email protected]>
- Added new configuration field (xml_query) to support custom XML queries - This new configuration item will conflict with existing simple query configuration items (ignore_older, event_id, level, provider) - Validator has been updated to check for key conflicts and XML syntax, but does not check for correctness of XML schema. - Added unit tests for config validation - Added unit/system test for XML query runner (cherry picked from commit b5e9414) Co-authored-by: Taylor Swanson <[email protected]>
What does this PR do?
query configuration items (ignore_older, event_id, level, provider)
but does not check for correctness of XML schema.
Why is it important?
The existing filtering options for Winlogbeat don't provide enough control when trying to filter out unwanted events. A user may want to include multiple channels in the same query or filter out certain SIDs. Custom XML queries provide a very powerful mechanism for fine tuning what events should be searched.
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
record_number
at the top-level registry entry is irrelevant here, since winlogbeat will always select the bookmark value(s) first. The record_number is only used in cases where custom queries are NOT given and no bookmark was produced previously (I've never seen this occur, so I'm not sure under what circumstances this will happen).Related issues