# Automation conditions

> Conditions decide when a rule actually runs. Without them, a rule runs on every matching event; with them, it runs only when the event's details match.

Source: https://infranest.io/docs/automation-conditions
Last updated: 2026-09-14

---

Conditions let you control exactly when an automation runs, so you're not flooded with alerts for every little change.

## Overview

- Without conditions, a rule runs on **every** matching event.
- With conditions, the rule only runs when the event's details match what you've specified.
- All conditions must match — they're combined with **and** — unless you use a group (see below).

## Add a condition

1. Open the automation you want to edit, or start a **New automation**.
2. Under **Conditions**, select **Add condition**.
3. Choose the **Field** you want to check. The available fields depend on the trigger you picked — for example, a *Domain expiring* trigger offers **Watched domain** and **Days until expiry**, while a **Monitor alert** trigger offers fields like status and monitor type.
4. Choose an **Operator** — options include **equals**, **not equals**, **contains**, **doesn't contain**, **greater than**, **greater or equal**, **less than**, **less or equal**, **is one of**, **is not one of**, **is set**, and **is not set**.
5. Enter the **Value** to compare against. You can type a fixed value, or select **Insert value** to use a placeholder from **Earlier values** — this lets you compare the field to another piece of live data instead of a fixed one.
6. Repeat to add more conditions. Use **Move up** / **Move down** to reorder them if needed.
7. Select **Save automation** when you're done.

> [!NOTE]
> Leave conditions empty to run the automation on every matching event.

## Examples of common conditions

1. **Domain expiring** trigger with **Days until expiry** **less than** `14` — only warn when renewal is close.
2. **Monitor alert** trigger with status **equals** "down" — act on outages, not recoveries.
3. **DNS record changed (in-app)** trigger with record type **is one of** A, AAAA — only address records.
4. **Domain status changed** trigger with new nameservers **contains** "cloudflare" — only when a domain moves to Cloudflare.

## Mix "and" and "or" with groups

1. Select **Add condition** as usual for your first rule.
2. Select **Add group** to create a group of conditions with its own **Match** toggle — choose **Any** (matches if one condition is true) or **Match all** (every condition must be true).
3. Add your conditions inside the group.
4. Combine groups and individual conditions at the top level using **Any** or **All** under **of these conditions** to build logic like "(days left < 14 **and** tag is production) **or** the certificate is already expired."
5. Groups can be nested inside other groups if your logic needs it.
6. Select **Remove group** to delete a group you no longer need.

## Restrict a rule to certain times

1. Select **Add condition**.
2. Choose **Field**, then pick one of the built-in time fields: **Day of week**, **Hour of day (0–23)**, or **Weekend**.
3. Set the **Operator** and **Value** — for example, **Hour of day (0–23)** **greater or equal** `18` to only act after 6pm, or **Weekend** **equals** "no" to restrict to weekdays.

> [!NOTE]
> Time-based fields are evaluated in the platform's timezone.

## Tips

- Use the **Preview (dry run)** or **Test run** option to check whether your conditions would have matched a real event before saving.
- Check **{n} of {total} matched** in the run history to confirm your conditions are behaving as expected.

> [!TIP]
> If you're not sure which fields are available for your trigger, check the **Automation triggers and actions** article — each trigger lists its own set of fields.

<!-- docs-screenshots:start -->

![Automation conditions](/media/8de8002e-e3b0-46c5-9806-d382566d9974)

<!-- docs-screenshots:end -->
