-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Hi, I don't know where to ask so trying here. I have a system where windows hosts collect logs using Loki, and a part of the config.alloy looks like:
loki.source.windowsevent "defender" {
eventlog_name = "Microsoft-Windows-Windows Defender/Operational"
forward_to = [loki.write.defender.receiver]
}
-----
loki.write "defender" {
external_labels = {
env = env("env"),
service = "windows_server",
type = "security",
location = env("location"),
computer = string.to_lower(env("COMPUTERNAME")),
server_uuid = env("uuid"),
}
endpoint {
url = "https://...../push"
}
}
that produces logs which can look something like (filtering on event_id=5007 just as an example)
{"source":"Microsoft-Windows-Windows Defender","channel":"Microsoft-Windows-Windows Defender/Operational","computer":"some_name","event_id":5007,"level":4,"levelText":"Information","opCodeText":"Info","keywords":"0x8000000000000000","timeCreated":"2025-06-24T07:13:18.6155840Z","eventRecordID":14332,"execution":{"processId":3568,"threadId":17564,"processName":"MsMpEng.exe"},"security":{"userId":"S-1-5-18","userName":"NT AUTHORITY\\SYSTEM"},"event_data":"\u003cData Name='Product Name'\u003eMicrosoft Defender Antivirus\u003c/Data\u003e\u003cData Name='Product Version'\u003e4.18.25050.5\u003c/Data\u003e\u003cData Name='Old Value'\u003eHKLM\\SOFTWARE\\Microsoft\\Windows Defender\\UX Configuration\\ToastOrSsoTrigger = 0x0\u003c/Data\u003e\u003cData Name='New Value'\u003eHKLM\\SOFTWARE\\Microsoft\\Windows Defender\\UX Configuration\\ToastOrSsoTrigger = 0x1\u003c/Data\u003e","message":"Microsoft Defender Antivirus Configuration has changed. If this is an unexpected event you should review the settings as this may be the result of malware.\r\n \tOld value: HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\UX Configuration\\ToastOrSsoTrigger = 0x0\r\n \tNew value: HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\UX Configuration\\ToastOrSsoTrigger = 0x1"}
However, doing sigma -t loki on files in rules/windows/builtin/windefend produces things like
{job=~"eventlog|winlog|windows|fluentbit.*"} | json | EventID=5007 and NewValue=~`(?i).*\\Real\-Time\ Protection\\SubmitSamplesConsent\ =\ 0x0.*`
There is a mismatch. I have to start my grafana query by {channel=~"Microsoft-Windows-Windows Defender/Operational"} (instead of job=~"eventlog|winlog|windows|fluentbit.*"}, I have to use event_id rather than EventID, and NewValue does not exist (but there are New Value and New value hidden deep in the log data).
It feels like I am missing some (likely obvious) step or conversion, can someone point at a place where I could understand what I should add (and where)?
Thank you.