Skip to content

Using Tera templates in routing rule conditions

A routing rule condition is a Tera expression that must evaluate to true or false.

The system automatically wraps your input with {{ }}, so you only need to provide the expression itself.

Common use cases

Condition for alert name starting with certain text

alertDef.name is starting_with("CPU")

Condition for alert name contains certain text

alertDef.name is containing("CPU")

Condition for alert name matching the regex

alertDef.name is matching("(?i)^cpu") 

Condition for alert containing a specific label

alertDef.entityLabels.group is defined

Condition for alert containing a specific value for a label

alertDef.entityLabels.environment == 'production'

How it’s different from other templates

  • Boolean only: Regular templates render text; condition templates must yield a boolean. Any non‑boolean output is invalid.
  • Do not include {{ }}, only the expression.
  • If the expression fails because variable does not exist, the condition evaluates to false.

Syntax quick start

Comparisons

==, !=, >, >=, <, <=

Logic

and, or, not