Use CEL Expressions in Runbook Triggers
Learn how to use CEL expressions to write dynamic trigger conditions for runbooks in Harness AI SRE.
CEL (Common Expression Language) expressions provide conditional logic for trigger conditions that go beyond simple field comparisons.
CEL expressions cannot be tested or previewed before they execute. Syntax validation occurs when you save, but runtime errors only appear in execution logs. Test triggers in non-production environments first.
Access CEL mode in triggers
To switch a trigger from Rule mode to CEL mode:
Open your runbook and go to the Triggers tab
Click + New Trigger or edit an existing trigger
In the conditions section, look for the Rule/CEL toggle or mode selector
Select CEL mode
The UI switches to show
${{}}delimiters with a text input areaType your CEL boolean expression
The input provides syntax highlighting for CEL keywords and operators
CEL trigger syntax
CEL trigger conditions must evaluate to a boolean (true or false). When the expression evaluates to true, the runbook executes.
Basic structure:
The ${{}} delimiters are displayed in the UI but you only need to write the expression inside them.
Available data in trigger conditions
Incident-based triggers can access:
Alert-based triggers can access:
Common CEL trigger patterns
Severity and environment:
Multiple severities:
Service pattern matching:
Complex multi-condition logic:
Alert source filtering:
CEL trigger examples by use case
1. Critical production incidents only:
2. High-severity incidents in any environment:
3. Payment service issues:
4. Production issues affecting multiple users:
5. After-hours critical alerts (requires time input):
6. Database incidents requiring immediate escalation:
7. API errors above threshold:
8. Unassigned critical incidents:
9. Multi-service outages:
10. Customer-impacting incidents:
CEL versus Rule mode comparison
Rule mode example:
Condition Type: ALL
Field: severity
Operator: equals
Value: "0"
AND
Field: environment
Operator: equals
Value: "production"
Equivalent CEL expression:
Rule mode limitations overcome by CEL:
Cannot use regex matching. CEL:
.matches()Cannot check multiple values efficiently. CEL:
in ["0", "1"]Cannot perform calculations. CEL:
(errors / total) > 0.05Cannot check null values. CEL:
owner != nullLimited string operations. CEL:
.contains(),.startsWith(),.endsWith()
Trigger frequency with CEL
CEL conditions work with all trigger frequency options:
Activity Created:
Activity Updated:
Key Event Created:
ACTIVITY UPDATED WITH CEL
Using "Activity Updated" with CEL evaluates the expression on every field change. This can cause frequent trigger evaluations. Use specific field-change logic or narrow your CEL condition to reduce execution frequency.
Troubleshooting CEL triggers
Next steps
Go to Create dynamic content to review the complete CEL syntax reference, additional operators, and advanced patterns.
Go to Create runbook triggers to learn about trigger configuration.
Go to Use Mustache templates in runbooks to learn about accessing incident and alert data in runbook actions.
Last updated
Was this helpful?