Running winlogbeat version 8.11.1 and trying to use a custom xml_query for the event logs. My issue is the data I need to match contains a new line sequence that is proving difficult to filter for.
Provided here in an include example of what I am trying to match, once I get the match working, I can apple this to an exclude filter I'm actually trying to make to ignore all the powershell noise.
---
winlogbeat.event_logs:
- id: new-line-test
fields:
version: 0
xml_query: |
<QueryList>
<Query Id="0" Path="Microsoft-Windows-PowerShell/Operational">
<Select Path="Microsoft-Windows-PowerShell/Operational">
*[System[EventID=4103]] and
*[EventData[Data[@Name='Payload']='CommandInvocation(Out-Default): "Out-Default" ']]
</Select>
</Query>
</QueryList>
output.kafka:
hosts: ["kafka:9092"]
topic: winlogbeat
Notice the hex encoded chars for \r\n
this filter works just fine in Event Viewer
These escaped new line chars do not work in PowerShell and if you use wevtutil this would be the corresponding structured query that would work:
<QueryList>
<Query Id="0" Path="Microsoft-Windows-PowerShell/Operational">
<Select Path="Microsoft-Windows-PowerShell/Operational">
*[System[EventID=4103]] and
*[EventData[Data[@Name='Payload']='CommandInvocation(Out-Default): "Out-Default"
']]
</Select>
</Query>
</QueryList>
I've tried escaped \r\n
, I've tried literal new-line in my yaml file, and I've even tried \n
hoping it would just work.
Any ideas how to get a structured query like this to work? Would this be considered a bug? There has to be something with the >
or |
scalar formatting and the xml nested that is causing a problem, but I can't get any of it to work.
I'd like to figure this out so I can use a single query for some of my logs and have the query itself filter out the noise instead of reading it all and dropping it in a processor. Main reason for this is the log volume I'm reading is pretty high and results in higher than expected resource utilization from Winlogbeat. I tend to read then drop nearly 90% of the logs.