Hello Wazuh team,
I'm trying to parse this log:
Oct 19 11:21:44 MTK clientsname (10.10.20.103): logged in
using these decoders:
<decoder name="mikro-clientsname">
<prematch>^clientsname</prematch>
</decoder>
<decoder name="clientsname-loggedin">
<parent>mikro-clientsname</parent>
<regex offset="after_parent">^\s\((.+)\): logged in</regex>
<order>ipaddress</order>
</decoder>
I used the wazuh-logtest tool to see if the log was being correctly parsed, but it just matches with the parent rule: mikro-clientsname and not clientsname-loggedin as intended. The only way I could parse the child rule was by removing the parents rule and writing the decoder like this:
<decoder name="clientsname-loggedin">
<prematch>^clientsname</prematch>
<regex>^clientsname\s\((.+)\): logged in</regex>
<order>ipaddress</order>
</decoder>
However this doesn't scale very well in the future and is less organized and readable. Can someone help me understand why the parent-child decoders approach didn't work?
Thank you for you help,
Best regards,
Joaquim Antonio