# Advance logic alter rules (if "A" happens look for "B"

**URL:** <https://discuss.elastic.co/t/advance-logic-alter-rules-if-a-happens-look-for-b/346529>\
**Category:** Elastic Security\
**Created:** [November 6, 2023, 1:50pm UTC](https://discuss.elastic.co/t/advance-logic-alter-rules-if-a-happens-look-for-b/346529 "2023-11-06T13:50:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![B-Rad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/b-rad/32/127210_2.png) [@B-Rad](https://discuss.elastic.co/u/B-Rad)\
**Post date:** [November 6, 2023, 1:50pm UTC](https://discuss.elastic.co/t/advance-logic-alter-rules-if-a-happens-look-for-b/346529/1 "2023-11-06T13:50:31Z")

</div>

When creating an alert rule is it possible to add some more advanced logic or additional criteria if the first query is triggered?

For example,

- I have authentication logs from our Idp
- I have an alert rule set for potential password compromise based on a few conditions (unknown device, successful password, fail MFA)

To help reduce the number of false positive alerts I would like to add something like "if" statements.,

For example,

- if the rule is triggered (based on the above conditions) check the last 60-day login history for that user and IP address...
- if they have high percentage of success (MFA too) then it is not an alert
- if there is no history of success from that IP and username then create an alert

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 4, 2023, 1:51pm UTC](https://discuss.elastic.co/t/advance-logic-alter-rules-if-a-happens-look-for-b/346529/2 "2023-12-04T13:51:30Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
