Hello everybody,
I think, me and my team, we found a good solution, thanks to the entries here in the mail group and with the help of the documentation.
Ultimately we used or wrote a kind of overlay decoder.
1) First, we made sure in the rsyslog that the JSON keys forwarded by the elastic-SIEM are adjusted so that the keys correspond to those from Wazuh. For this we used the mmjsonparse plugin from json.
The agent on the rsyslog reads the data with <logformat> json</logformat>
2) Afterwards it was necessary to adapt or slow down the json decoder built into Wazuh.
In our case, all logs start with {"win"..... We took advantage of this and, first quickly and dirty, adjusted the entries in 0006-json-decoders.xml in /var/ossec/ruleset/decoders.
The original prematch entry was adjusted so that the jsondecoder does not start immediately.
Old:
<prematch type=>^{\s*"</prematch>
New:
<prematch type="pcre2">^{\s*"[^w]</prematch>
So the JSon decoder continues to work, but not for Json files that start with {"win".
3) Now we had to build a new decoder.
This is called "windows_eventchannel" and is of type "ossec", which will be important in the rules at a later date.
Decoder:
<decoder name="windows_eventchannel">
<!--parent>json</parent-->
<use_own_name>true</use_own_name>
<prematch type="pcre2">^{\s*\"[w]</prematch>
<regex type="pcre2">providerName: ((?:.)*),\s*$</regex>
<order>win.system.providerName</order>
<type>ossec</type>
</decoder>
<decoder name="windows_eventchannel">
<parent>windows_eventchannel</parent>
<use_own_name>true</use_own_name>
<plugin_decoder>JSON_Decoder</plugin_decoder>
</decoder>
Hello everybody,
I think we found a good solution, thanks to the entries here in the mail group and with the help of the documentation.
Ultimately we used or wrote a kind of overlay decoder.
1) First, we made sure in the rsyslog that the JSON keys forwarded by the elastic-SIEM are adjusted so that the keys correspond to those from Wazuh. For this we used the mmjsonparse plugin from json.
The agent on the rsyslog reads the data with <logformat> json</logformat>
2) Afterwards it was necessary to adapt or slow down the json decoder built into Wazuh.
In our case, all logs start with {"win"..... We took advantage of this and, first quickly and dirty, adjusted the entries in 0006-json-decoders.xml in /var/ossec/ruleset/decoders.
The original prematch entry was adjusted so that the jsondecoder does not start immediately.
Old:
<prematch type=>^{\s*"</prematch>
New:
<prematch type="pcre2">^{\s*"[^w]</prematch>
So the JSon decoder continues to work, but not for Json files that start with {"win".
3) Now we had to build a new decoder.
This is called "windows_eventchannel" and is of type "ossec", which will be important in the rules at a later date.
Decoder:
<decoder name="windows_eventchannel">
<!--parent>json</parent-->
<use_own_name>true</use_own_name>
<prematch type="pcre2">^{\s*\"[w]</prematch>
<regex type="pcre2">providerName: ((?:.)*),\s*$</regex>
<order>win.system.providerName</order>
<type>ossec</type>
</decoder>
<decoder name="windows_eventchannel">
<parent>windows_eventchannel</parent>
<use_own_name>true</use_own_name>
<plugin_decoder>JSON_Decoder</plugin_decoder>
</decoder>
In the decoder it is still important that the win.system.providerName entry is extracted.
We think this is the only way the first standard rule 0575-win-base_rules.xml can continue to be used.
This rule checks the category for "ossec" and whether the events are decoded as windows_eventchannel. Check the code of 0575-win-base_rules.xml :
....
<group name="windows,">
<rule id="60000" level="0">
<category>ossec</category>
<decoded_as>windows_eventchannel</decoded_as>
<field name="win.system.providerName">\.+</field>
....
All of the following rules are then based on the rule in question, so that from then on you can use Wazuh's normal built-in rule set again
This email group entry helped us get on the right path:
Thanks for that.
We tested whether Windows event channel logs read via a Windows agent continue to work, which is actually the case.
If there is another, possibly easier or better way, please let me know.
Otherwise, I hope that the way we found and the description here will help others with their implementation
Kind regards
Marcel