Decoder:
<decoder name="mikrotik_winbox_generic">
<prematch>\.*from \.*</prematch>
<regex>user (\S+) \.*from (\d+.\d+.\d+.\d+)</regex>
<order>srcuser, srcip</order>
</decoder>
Rules:
<group name="syslog,mikrotik,">
<rule id="200010" level="3">
<match>logged in</match>
<description>User logged in.</description>
<group>access_control,authentication_success</group>
</rule>
<rule id="200020" level="3">
<match>logged out</match>
<description>User logged out.</description>
<group>access_control</group>
</rule>
<rule id="200030" level="12">
<match>login failure</match>
<description>User failed to login.</description>
<group>access_control,authentication_failed</group>
</rule>
<rule id="200040" level="10" timeframe="120">
<if_matched_sid>5710</if_matched_sid>
<if_sid>200030</if_sid>
<same_srcuser />
<description>Multiple login failures was triggered by same user.</description>
<group>access_control,authentication_failed</group>
</rule>
</group>
Log samples:
Jun 10 14:51:14 NoName user nauris logged out from 192.168.0.204 via winbox
Jun 10 14:51:45 NoName user nauris logged in from 192.168.0.204 via winbox
Jun 10 15:51:05 NoName login failure for user admin from 192.168.0.204 via winbox
Now decoder and rules are working, except for rule 200040, it was supposed to show if a user has failed login on ssh on other host and to be fired when the same user is trying to login to this mikrotik host within 120 seconds. But this does not work, I already created other post for this.
Here my question was, how does wazuh link decoders to rules and if it is necessary? If not, how wazuh understands how to use these custom rules after decoding my log.