-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[pkg/stanza/operator/input/windows] [receiver/windowseventlogreceiver] add raw XML query support #39055
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
[pkg/stanza/operator/input/windows] [receiver/windowseventlogreceiver] add raw XML query support #39055
Conversation
e5bd2d7
to
5133f5d
Compare
5133f5d
to
8c5d9a7
Compare
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.
@OverOrion sorry for the delay - this is looking good! We will need a test before this can be approved and merged. It will be good to add some examples and links on the README.md - something like https://learn.microsoft.com/en-us/previous-versions/aa385231(v=vs.85)#xml-event-queries for instance.
8c5d9a7
to
3c3c107
Compare
Hey @pjanotti I have extended the README with a sample configuration, let me know if that's what you had in your mind. |
Signed-off-by: Szilard Parrag <[email protected]>
3c3c107
to
9c94980
Compare
Hi @OverOrion - I was in a short break last week, will take a look soon. |
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.
@OverOrion - changes are looking good, the test that I was thinking about would be like the ones in receiver/windowseventlogreceiver/receiver_windows_test.go
, but, using the Query
on the config. Perhaps TestReadWindowsEventLogger
Signed-off-by: Szilard Parrag <[email protected]>
Added a similar test: > go test -count=1 . -v
=== RUN TestNewFactory
=== RUN TestNewFactory/NewFactoryCorrectType
--- PASS: TestNewFactory (0.00s)
--- PASS: TestNewFactory/NewFactoryCorrectType (0.00s)
=== RUN TestCreateDefaultConfig
--- PASS: TestCreateDefaultConfig (0.00s)
=== RUN TestCreateAndShutdown
--- PASS: TestCreateAndShutdown (0.00s)
=== RUN TestComponentFactoryType
--- PASS: TestComponentFactoryType (0.00s)
=== RUN TestComponentConfigStruct
--- PASS: TestComponentConfigStruct (0.00s)
=== RUN TestComponentLifecycle
=== RUN TestComponentLifecycle/logs-shutdown
=== RUN TestComponentLifecycle/logs-lifecycle
--- PASS: TestComponentLifecycle (0.00s)
--- PASS: TestComponentLifecycle/logs-shutdown (0.00s)
--- PASS: TestComponentLifecycle/logs-lifecycle (0.00s)
=== RUN TestDefaultConfig
--- PASS: TestDefaultConfig (0.00s)
=== RUN TestLoadConfig
--- PASS: TestLoadConfig (0.00s)
=== RUN TestCreateWithInvalidInputConfig
--- PASS: TestCreateWithInvalidInputConfig (0.00s)
=== RUN TestReadWindowsEventLogger
--- PASS: TestReadWindowsEventLogger (4.51s)
=== RUN TestReadWindowsEventLoggerWithQuery
--- PASS: TestReadWindowsEventLoggerWithQuery (4.51s)
=== RUN TestReadWindowsEventLoggerRaw
--- PASS: TestReadWindowsEventLoggerRaw (4.55s)
=== RUN TestExcludeProvider
=== RUN TestExcludeProvider/with_EventXML
=== RUN TestExcludeProvider/with_Raw
--- PASS: TestExcludeProvider (9.09s)
--- PASS: TestExcludeProvider/with_EventXML (4.28s)
--- PASS: TestExcludeProvider/with_Raw (4.26s)
PASS
ok github.com/open-telemetry/opentelemetry-collector-contrib/receiver/windowseventlogreceiver 22.719s |
Signed-off-by: Szilard Parrag <[email protected]>
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.
Thanks @OverOrion!
CI failure is unrelated, tracking via #39691
…] add raw XML query support (open-telemetry#39055) Example usage ```yaml receivers: windowseventlog/query: raw: true query: | <QueryList> <Query Id="0"> <Select Path="Application">*[System[Provider[@name='foo']]]</Select> <Select Path="Application">*[System[Provider[@name='bar']]]</Select> </Query> </QueryList> exporters: debug: verbosity: detailed service: pipelines: logs/query: receivers: [windowseventlog/query] exporters: [debug] ``` I tested it using `eventcreate`: ```powershell eventcreate /t ERROR /id 100 /l application /d "Create event in application log" /so foo ``` --------- Signed-off-by: Szilard Parrag <[email protected]>
…] add raw XML query support (open-telemetry#39055) Example usage ```yaml receivers: windowseventlog/query: raw: true query: | <QueryList> <Query Id="0"> <Select Path="Application">*[System[Provider[@name='foo']]]</Select> <Select Path="Application">*[System[Provider[@name='bar']]]</Select> </Query> </QueryList> exporters: debug: verbosity: detailed service: pipelines: logs/query: receivers: [windowseventlog/query] exporters: [debug] ``` I tested it using `eventcreate`: ```powershell eventcreate /t ERROR /id 100 /l application /d "Create event in application log" /so foo ``` --------- Signed-off-by: Szilard Parrag <[email protected]>
Example usage
I tested it using
eventcreate
: