I've stumble upon the same needs but the <same_system_name/> tag doesn't seem to be working:
Here is the decoder:
<decoder name="huawei-ssh">
<prematch>%%\d+SSH</prematch>
</decoder>
<!-- Feb 01 14:55:37 <device_name> %%01SSH/4/SSH_FAIL(s)[0]:Failed to login through SSH. (IP=<IP>, VpnInstanceName= , UserName=<user>, Times=1, FailedReason=User public key authentication failed) -->
<decoder name="huawei-ssh-fail">
<parent>huawei-ssh</parent>
<use_own_name>true</use_own_name>
<prematch type="pcre2">SSH_FAIL</prematch>
<regex type="pcre2" offset="after_prematch">Failed to login through SSH\. \(IP=(\S+), VpnInstanceName=\s*(\S*), UserName=(\S+), Times=(\d+), FailedReason=(.+)\)</regex>
<order>srcip,vpninstance,username,times,failedreason,system_name</order>
</decoder>
Here is the rule:
<rule id="100301" level="5">
<decoded_as>huawei-ssh-fail</decoded_as>
<match>Failed to login</match>
<description>$(hostname): User '$(username)' failed to login through SSH from $(srcip). The reason was: '$(failedreason)'. This is the $(times) time this user has failed to login.</description>
<group>authentication,ssh</group>
</rule>
<rule id="100302" frequency="5" level="13" ignore="300" timeframe="300">
<if_matched_sid>100301</if_matched_sid>
<same_system_name/>
<!-- <same_field>username</same_field> -->
<description>$(hostname): User '$(username)' failed to login through SSH from $(srcip) 5 times. This alert will be suppressed for 5 minutes.</description>
<mitre>
<id>T1110</id>
</mitre>
<group>authentication,ssh</group>
</rule>
I believe its worth mentioning that the device generating these logs is not a Wazuh Agent, but a network device (Huawei). I'm sending the device's logs to wazuh directly.
I already have other rules that work with these logs, but now I need to aggregate them based on individual hosts.
Can you help me?