Create Your First Dynamic Content
Build dynamic content with CEL and Mustache expression languages.
Harness AI SRE supports two expression languages for creating dynamic content: CEL (Common Expression Language) for logic and conditions, and Mustache for simple variable substitution.
CEL versus Mustache
Choose the right expression language based on your needs:
Feature
CEL (${{expression}})
Mustache ({{variable}})
Purpose
Logic and computation
Simple variable substitution
Use cases
Conditions, transformations, calculations
Display values, basic templating
Capabilities
Boolean logic, regex, math, functions
Variable interpolation only
Syntax
${{incident.severity == "0"}}
{{incident.severity}}
Return types
Any type (string, number, boolean, array, object)
String only
Mixing
Cannot mix with Mustache in same field
Cannot mix with CEL in same field
When to use each
Use CEL when you need:
Conditional logic: Filter or route based on conditions.
Regex matching: Pattern matching on service names or messages.
Calculations: Math operations, thresholds, percentages.
Transformations: String manipulation, datetime formatting.
Complex logic: Multi-field boolean expressions.
Use Mustache when you need:
Simple display: Show field values in messages.
Basic templating: Insert variables into text.
Field mapping: Map source fields to destination fields.
Static substitution: Replace placeholders with values.
Where to use CEL
CEL is available in these contexts:
1. Alert rule conditions
Filter incoming alerts before creating incidents.
Example:
Go to Use CEL in Route Alerts to filter alerts.
2. Runbook trigger conditions
Control when runbooks automatically execute.
Example:
Go to Use CEL in Runbook Triggers to control runbook execution.
3. Webhook advanced mapping conditions
Filter webhook payloads before creating alerts.
Example:
Go to Use CEL in Webhooks to filter webhook payloads.
4. Runbook action fields (inline)
Embed CEL expressions in text fields for dynamic content.
Example:
Go to Use CEL in Runbook Actions to embed expressions in action fields.
Where to use Mustache
Mustache is available in these contexts:
1. Runbook action fields
Insert field values into messages, tickets, and notifications.
Example:
Go to Use Mustache in Runbook Actions to insert field values into actions.
2. Map webhook fields
Map webhook payload fields to alert properties.
Example:
Go to Use Mustache in Webhooks to map payload fields to alerts.
Harness-specific information
Feature flag
CEL expressions require the feature flag IR_CEL_CONDITIONS. Contact your Harness account team to enable this feature.
Expression limits
CEL and Mustache expressions have the following limits:
Max CEL expression length: 4,096 characters
No mixing: Cannot use both CEL and Mustache in the same field
No preview: Expressions cannot be tested before execution
Harness-specific data
Severity values are strings, not numbers:
Timestamps are milliseconds since Unix epoch:
Common patterns
Severity checks
Single severity:
Multiple severities:
String operations
Contains check:
Regex matching:
Regex extraction:
Case conversion:
String trimming:
Replace text:
Null safety and default values
Always check for null:
Provide default values with orValue():
Mustache nested fields
Access nested data:
Collection operations
CEL provides powerful collection operations for working with arrays and lists.
Get collection size:
Check if any item matches:
Extract Harness service IDs from impacted services:
Get first service ID:
Filter services by name pattern:
Count services matching a condition:
Combine operations:
Examples
CEL: dynamic Slack message
Mustache: simple Jira ticket
Related concepts
CEL language reference
Go to cel.dev to read the official CEL documentation.
Go to the CEL language definition to review the complete syntax reference.
Harness AI SRE guides
Last updated
Was this helpful?