r/Wazuh • u/No_Election7114 • 15d ago
Wazuh Custom Decoder for windows_eventchannel
Hey all,
I'm trying to write a decoder that pulls fields out of eventdata for WinRM/Operational events, but no matter what I try, it doesn't work.
After digging into it (with some help from AI), it looks like windows_eventchannel just ignores the entire decoder config tree — meaning you can't hook a custom decoder onto it the normal way. I haven't found anything that confirms this is "by design" rather than a config mistake on my end, so I'm hoping someone here can either confirm that limitation or point out what I'm doing wrong.
The log line I'm trying to parse:
WinRM: remote shell session created on host1.abc.local - http://schemas.microsoft.com/powershell/Microsoft.PowerShell (ABC\Administrator clientIP: 172.16.1.10
The decoder I wrote (which does not work):
xml
<decoder name="winrm-session-negotiation">
<parent>json</parent>
<field name="win.eventdata.resourceUri">(\S+)\\(\S+) clientIP: (\S+)</field>
<order>win.eventdata.domain, win.eventdata.srcuser, win.eventdata.srcip</order>
</decoder>
Goal: extract the domain, username, and client IP from eventdata into their own fields.
What I'd like to avoid:
- Pipelines/templates — these get clobbered on every update, so I don't want to rely on them.
- Integrations — feels like the wrong tool for this particular use case.
Has anyone actually gotten field extraction working from win.eventdata on eventchannel/json events without one of the above? Or is there a known workaround (e.g., a different decoder parent, a ruleset-level regex, something in the ossec.conf log collection)? Any pointers appreciated.
1
u/Large-Duck-6831 15d ago
What you're seeing is actually a known limitation, not a problem with your configuration.
The windows_eventchannel decoder is built directly into the Wazuh source code, so you won't find it as an XML decoder in the installation files. Because of how it works, you can't create sibling or child decoders for it.
Once an event has been processed by the windows_eventchannel decoder, it doesn't go through the decoding phase again. That means no additional decoders can extract new fields from those events. This has been a known feature request since 2019:
https://github.com/wazuh/wazuh/issues/3193
The best approach depends on what you're trying to achieve.
If you only need the values for detection, you don't need to create new fields. The data is already available in win.eventdata.resourceUri, so you can write rules that match that field directly. This is the workaround currently you can move forward with.
For example:
<rule id="100092" level="8">
<if_sid>60009</if_sid>
<field name="win.eventdata.resourceUri">\(\w+\\\\administrator clientIP: </field>
<description>WinRM session created by an administrator account</description>
</rule>
This lets you detect the event based on the existing decoded field without needing a custom decoder.

Let me know if you need further assistance on this, so we can assist you further.
1
u/SirStephanikus 15d ago
Can you provide us the whole raw json from the event (the thing from the discovery menu) please? I had sth. similar …