I have an agent where I scan a logfile with Postfix log entries. If there is a log entry that looks like the one below, I want to trigger a rule. This rule should activate a response script with the from= email as input. I need to escape the from email address from the log entry. I’ve tried, but I feel that my regular expression isn’t working at all. When I insert the log entry into the rule tester, it triggers rule 3303, which is a Postfix rule (makes sense). However, I want the log entry to trigger my custom rule with rule ID 100400.
Here is my log entry:
Hi Wilco,
You need to create a rule like this:
<group name="postfix-custom">We use <if_sid> because the default rule (3303) is already triggering when testing the log. This custom rule (100400) is a child rule that refines the detection by matching the specific log message. If the log contains this message and the parent rule (3303) is triggered, then rule 100400 will activate.
To learn more about rule syntax and regex: https://documentation.wazuh.com/current/user-manual/ruleset/ruleset-xml-syntax/rules.html and https://documentation.wazuh.com/current/user-manual/ruleset/ruleset-xml-syntax/regex.html
Let me know if you need any further assistance!