Hello Olamilekan,
Thanks you for your help. Answering your previous question about the ruletest, yes on ruletest it worked fine.
Following your suggestion, I tried a cleaner approach by splitting the rule and reducing the frequency to 6 for testing purposes, but the problem still persists, rule 708007 is never triggered, even after reaching 6 attempts within the 10-minute timeframe:
<rule id="708004" level="6">
<decoded_as>custom_portal_login</decoded_as>
<description>Portal Log Found</description>
</rule>
<rule id="708005" level="7">
<if_sid>708004</if_sid>
<field name="state">failure</field>
<description>Portal: Failed Login</description>
</rule>
<rule id="708006" level="7">
<if_sid>708004</if_sid>
<field name="state">Successful</field>
<description>Portal: Successful Login</description>
</rule>
<rule id="708007" level="8" frequency="6" timeframe="600">
<if_matched_sid>708005</if_matched_sid>
<same_srcuser />
<description>Portal: Multiple Login Failures</description>
</rule>
<rule id="708008" level="9">
<if_matched_sid>708007</if_matched_sid>
<if_sid>708006</if_sid>
<same_srcuser />
<description>Portal: Multiple Login Failures followed by a success</description>
</rule>
When testing with ruletest using the same logs received in Wazuh, everything works as expected. However, in a real scenario where I fail the login 7 times, the rule never fires. Instead, rule 708005 triggers 7 times, when it should trigger 708007 on the 6th attempt.
I tried with 5 or less in the 708007 frequency and it worked fine btw.
I have already confirmed that no other events are being triggered for these logs.
Attached are the raw logs, the ruletest output, and the exported logs from Wazuh Discover.