Hi ektadhussa1113,
Yes, it's possible to create a rule for that requirement.
The decoders would be similar to the last message:
<decoder name="nps">
<prematch>^\<Event>\.+</prematch>
</decoder>
<decoder name="nps-failed-connection">
<parent>nps</parent>
<regex>SAM-Account-Name data_type="\d">(\.+)\<\.+Reason-Code data_type="\d">(\d+)</regex>
<order>sam-account,reason-code</order>
</decoder>In this case, we catch SAM-Account-Name instead of User-Name
Now you only need to change your rule configuration.
<rule id="100002" level="3">
<decoded_as>nps</decoded_as>
<description>Failed conection NPS</description>
<field name="reason-code">1|2|3|4|5|6|7|8|9|\d\d</field>
</rule>
<rule id="100023" level="5" frequency="3">
<if_matched_sid>100002</if_matched_sid>
<description>3 times Failed connection</description
<same_field>sam-account</same_field>
<options>alert_by_email</options>
</rule>This configuration will send an email every time rule 100023 is triggered.
This new rule use frequency, same_field and alert_by_email options. You can check more information in this documentation page:
https://documentation.wazuh.com/3.13/user-manual/ruleset/ruleset-xml-syntax/rules.htmlAlso, you need to configure email alerts. For that matter, you need to edit your ossec.conf, in <global> option.
<ossec_config>
<global>
<email_notification>yes</email_notification>
<email_to>m...@test.com</email_to>
<smtp_server>mail.test.com</smtp_server>
<email_from>wa...@test.com</email_from>
</global>
...
</ossec_config>Replacing your email configuration. After that, you need to restart wazuh manager using this command:
systemctl restart wazuh-managerFor more information, you can follow this guide:
https://documentation.wazuh.com/3.13/user-manual/manager/manual-email-report/. This blog post could be useful too
https://wazuh.com/blog/how-to-send-email-notifications-with-wazuh/Regards.