Alert payload reference
When an alert triggers or resolves, Notification Center builds a payload that describes the alert and the event, then renders your templates against it. This page is the schema of that payload: every field an alert notification exposes, organized by namespace. Use these paths in preset message bodies, routing rule conditions, and templated connector fields, all in Tera syntax.
For the Case payload, see Case payload reference. For an overview of every namespace across both entity types, see Template variables.
To see the exact payload for one alert, put {{ get_context() | json_encode(pretty=true) }} in a draft preset body and read the preview.
Supported entity subtypes
An entity subtype adds a layer of granularity to an entity type. For Alerts, an entity subtype consists of three elements: an alert type, a condition, and status.
The following entity subtypes for Alerts are supported:
| Source | Type | Condition | Status | Description |
|---|---|---|---|---|
| Logs | LOGS_IMMEDIATE | N/A | Triggered / Resolved | Alert immediately when a log of interest is detected. Docs |
| Logs | LOGS_THRESHOLD | More than / Less than | Triggered / Resolved | Alert when the sum of logs crosses a predefined threshold. Docs |
| Logs | LOGS_RATIO_THRESHOLD | More than / Less than | Triggered / Resolved | Alert when the ratio between two log queries reaches a set threshold. Docs |
| Logs | LOGS_TIME_RELATIVE_THRESHOLD | More than / Less than | Triggered / Resolved | Alerts when a fixed ratio reaches a set threshold compared to a past time frame. Docs |
| Logs | LOGS_ANOMALY | More than usual | Triggered / Resolved | Alert when a log crosses an AI-generated baseline. Docs |
| Logs | LOGS_NEW_VALUE | N/A | Triggered | Alert on a newly detected value in a time series. Docs |
| Logs | LOGS_UNIQUE_COUNT | More than | Triggered | Alert based on a unique value count per key. Docs |
| Metrics | METRIC_THRESHOLD | More than / Less than / More than or equals / Less than or equals | Triggered / Resolved | Alert when a metric crosses a predefined threshold. Docs |
| Metrics | METRIC_ANOMALY | More than usual / Less than usual/ | Triggered /Resolved | Alert when a metric crosses an AI-generated baseline. Docs |
| Tracing | TRACING_IMMEDIATE | N/A | Triggered | Alert immediately when span duration exceeds a set latency. Docs |
| Tracing | TRACING_THRESHOLD | More than | Triggered | Alert when trace latency crosses a predefined threshold. Docs |
| Flow | FLOW | N/A | Triggered / Resolved | Alert when any combination of alerts occur in a specific sequence within a defined timeframe. Docs |
In a template, _context.entitySubType names the subtype in one string: the alert type, the condition, and the status, for example logsThresholdMoreThanTriggered or flowResolved. All supported entity subtypes, consisting of EntityType and EntitySubType, can be found in the Alerts API.
Template variable reference
Namespaces
| Namespace | What it holds | Use it for |
|---|---|---|
alertDef.* | The alert definition: name, description, priority, type, labels, and the type-specific configuration. | What the alert watches and how it is set up. |
alert.* | This alert event: status, time, highest priority, links, and one entry per group in alert.groups. | What happened and which groups it affects. |
_context.* | The notification envelope, shared by alerts and Cases: entity type and subtype, routing labels, team, and trigger. | Routing conditions and presets shared across entity types. |
| Top-level | Flat shortcuts: correlationKey, name, priority. | Integrations that expect a flat field, such as a deduplication key. |
alertDef.*: the alert definition
| Path | Type | Description | Example |
|---|---|---|---|
alertDef.name | string | Alert name. Template expressions in the name are rendered before the payload is built. | CPU usage high |
alertDef.description | string | Alert description. Template expressions are rendered, as for the name. | CPU above 90% for 5 minutes |
alertDef.id | string | Alert definition ID. Use it to build a link to the alert. | 123e4567-e89b-12d3-a456-426614174000 |
alertDef.alertVersionId | string | ID of the alert definition version that fired. | |
alertDef.type | string | Alert type. Matches the $type in alertDef.typeDefinition. | logsThreshold, metricThreshold, flow |
alertDef.priority | string | Priority set on the definition. | P2 |
alertDef.entityLabels | object | The alert's labels, as { key: value }. Read a value directly. | {{ alertDef.entityLabels["team"] }} |
alertDef.groupByKeys | array of strings | The alert's group-by keys. | ["host", "region"] |
alertDef.incidentSettings.notifyOn | string | When the alert notifies. | Triggered |
alertDef.incidentSettings.retriggeringPeriod.minutes | number | Minimum minutes between notifications for the same group. | 15 |
alertDef.createdTime, alertDef.updatedTime | number | When the definition was created and last changed, in Unix seconds. | 1700000000 |
alertDef.typeDefinition | object | The type-specific configuration. See Alert type configuration. |
alert.*: the alert event
| Path | Type | Description | Example |
|---|---|---|---|
alert.id | string | Alert event ID. | |
alert.status | string | Event status. | Triggered, Resolved |
alert.timestamp | number | When the event happened, in Unix seconds. Format it with the date filter. | {{ alert.timestamp | date(format="%Y-%m-%d %H:%M") }} |
alert.highestPriority | string | Highest priority across the event's groups. | P1 |
alert.groupingKey | string | Stable key for the alert and its groups. The same problem produces the same key, so use it to deduplicate in the destination. | d2d2d0b3f8ff... |
alert.alertDataUrl | string | Link to the event in Coralogix. | |
alert.editAlertUrl | string | Link to the alert definition. | |
alert.logsExploreUrl | string | Link to the matching logs in Explore, when the alert has one. | |
alert.hasNoData | boolean | true when any group fired because data stopped arriving. | false |
alert.statusBreakdown.totalGroupCount | number | How many groups the event covers. | 12 |
alert.statusBreakdown.totalTriggeredGroupCount | number | How many of them are triggered. | 3 |
alert.statusBreakdown.totalResolvedGroupCount | number | How many of them are resolved. | 9 |
alert.groups | array | One entry per group. See below. |
alert.groups[N].*: one entry per group
A group is one combination of group-by values, for example one host. An alert without group-by keys has a single group.
| Path | Type | Description | Example |
|---|---|---|---|
alert.groups[N].keyValues | object | The group's group-by values, as { key: value }. Read a value directly. | {{ alert.groups[0].keyValues["host"] }} |
alert.groups[N].status | string | Status of this group. | Triggered |
alert.groups[N].priority | string | Priority of this group. | P3 |
alert.groups[N].isNoData | boolean | true when this group fired because data stopped arriving. | false |
alert.groups[N].details | object | What the evaluation found for this group. See Group details by alert type. |
alert.groups holds a limited number of groups. When an event covers more, use alert.statusBreakdown for the totals instead of counting alert.groups.
Alert type configuration
alertDef.typeDefinition holds a $type key and one object named after the type. For example, a logs threshold alert's query is at alertDef.typeDefinition.logsThreshold.luceneQuery.
$type | Main fields under alertDef.typeDefinition.<type> |
|---|---|
logsImmediate | luceneQuery, applicationName[], subsystemName[], severities[], notificationPayloadFilter[] |
logsThreshold | The log filters above, plus rules[].condition.threshold, rules[].condition.timeWindow.logsTimeWindowSpecificValue, rules[].condition.conditionType, rules[].override.priority, undetectedValuesManagement |
logsRatioThreshold | numerator and denominator (each with the log filters), numeratorAlias, denominatorAlias, rules[].condition.threshold, rules[].condition.timeWindow.logsRatioTimeWindowSpecificValue, rules[].condition.conditionType, rules[].override.priority, ignoreInfinity |
logsTimeRelativeThreshold | The log filters, plus rules[].condition.threshold, rules[].condition.comparedTo, rules[].condition.conditionType, rules[].override.priority, ignoreInfinity, undetectedValuesManagement |
logsAnomaly | The log filters, plus rules[].condition.minimumThreshold, rules[].condition.timeWindow.logsTimeWindowSpecificValue, anomalyAlertSettings.percentageOfDeviation |
logsNewValue | The log filters, plus rules[].condition.keypathToTrack, rules[].condition.timeWindow.logsNewValueTimeWindowSpecificValue |
logsUniqueCount | The log filters, plus uniqueCountKeypath, maxUniqueCountPerGroupByKey, rules[].condition.maxUniqueCount, rules[].condition.timeWindow.logsUniqueValueTimeWindowSpecificValue |
metricThreshold | promql, rules[].condition.threshold, rules[].condition.forOverPct, rules[].condition.ofTheLast.metricTimeWindowSpecificValue, rules[].condition.conditionType, rules[].override.priority, missingValues, undetectedValuesManagement |
metricAnomaly | promql, rules[].condition.threshold, rules[].condition.forOverPct, rules[].condition.ofTheLast.metricTimeWindowSpecificValue, rules[].condition.minNonNullValuesPct, rules[].condition.conditionType, anomalyAlertSettings.percentageOfDeviation |
tracingImmediate | applicationName[], subsystemName[], serviceName[], operationName[], spanFields[], latencyThresholdMs, notificationPayloadFilter[] |
tracingThreshold | The tracing filters above, plus rules[].condition.spanAmount, rules[].condition.timeWindow.tracingTimeWindowValue, rules[].condition.conditionType, rules[].override.priority |
sloThreshold | sloDefinition.sloId, sloDefinition.name, sloDefinition.window, rules[].condition.threshold, rules[].override.priority |
flow | stages[].groups[].alertsOp, stages[].groups[].nextOp, stages[].timeframeMs, stages[].timeframeType, enforceSuppression |
errorTrackingNewIssue | query, warmUpPeriodMinutes, timeWindow.errorTrackingTimeWindowSpecificValue, notificationPayloadFilter[] |
In log filters, each applicationName[] and subsystemName[] entry has a value and an operation, such as Is. In tracing filters, each entry has values[] and an operation. For a custom metric time window, metricTimeWindowSpecificValue carries the window as a duration instead of a preset label.
Group details by alert type
alert.groups[N].details has the same layout: a $type key and one object named after the type. For example, a logs threshold group's count is at alert.groups[0].details.logsThreshold.countResult.
$type | Fields under alert.groups[N].details.<type> |
|---|---|
logsImmediate | log: the matching log. See The log object. |
logsNewValue | log: the log with the new value. |
logsThreshold | countResult, fromTimestamp, toTimestamp, conditionType, isUndetectedValue, log |
logsRatioThreshold | numeratorCount, denominatorCount, ratio, fromTimestamp, toTimestamp, conditionType |
logsTimeRelativeThreshold | latestCount, pastCount, ratio, fromTimestamp, toTimestamp, conditionType |
metricThreshold | avgValueOverThreshold, minValueOverThreshold, maxValueOverThreshold, pctOverThreshold, fromTimestamp, toTimestamp, conditionType, isUndetectedValue |
tracingImmediate | traceId |
tracingThreshold | count, fromTimestamp, toTimestamp |
sloThreshold | pctOverThreshold, fromTimestamp, toTimestamp, shortWindowOutput.pctOverThreshold |
flow | flowAlertsMatch[]: each matched stage, with from, to, and groups[] holding the events[] (alertId, eventId, timestamp) and resolvedAlerts[] |
logsUniqueCount | No fields. |
logsAnomaly and metricAnomaly groups have no details. fromTimestamp and toTimestamp are the evaluated time window, in Unix seconds.
The log object
Log alerts carry an example log in details.<type>.log. Only one group per event carries it, usually the first.
| Path | Description |
|---|---|
log.dollarD | The log body ($d). Read a field by name, for example log.dollarD.message. |
log.dollarL | The log's labels ($l), such as applicationname and subsystemname. |
log.dollarM.timestamp | Log timestamp, as an ISO 8601 string. |
log.dollarM.severity | Log severity. |
log.dollarM.logID | Log ID. |
For example: {{ alert.groups[0].details.logsImmediate.log.dollarD.message | default(value="") }}.
_context.*: the notification envelope
| Path | Description | Example |
|---|---|---|
_context.entityType | Always alerts for alert notifications. | alerts |
_context.entitySubType | Type, condition, and status in one string. | metricThresholdMoreThanTriggered |
_context.entityLabels | Routing labels. Array-shaped: index with [0]. For alerts, each array holds one value. | {{ _context.entityLabels["team"][0] }} |
_context.system | Your Coralogix team: id, name. | {{ _context.system.name }} |
_context.trigger | type (manual or automatic), manualTrigger.userEmail, automaticTrigger. | {{ _context.trigger.type }} |
See Label data shapes for why _context.entityLabels needs [0] and alertDef.entityLabels doesn't.
Top-level variables and functions
| Name | Description |
|---|---|
correlationKey | Mirrors alert.groupingKey. Use it as the deduplication key for PagerDuty or ServiceNow-style integrations. |
name | Mirrors alertDef.name. |
priority | Mirrors alert.highestPriority. |
get_context() | The whole payload. Use it to debug. |
Timestamps in templates
An alert event has one timestamp, alert.timestamp. Groups don't carry their own trigger time. For threshold-type alerts, each group's details holds the evaluated window in fromTimestamp and toTimestamp. For example, for a logs threshold alert:
{% for g in alert.groups %}
{% if g.details.logsThreshold.fromTimestamp is defined %}
{{ g.keyValues | json_encode() }}: {{ g.details.logsThreshold.fromTimestamp | date(format="%Y-%m-%d %H:%M") }} to {{ g.details.logsThreshold.toTimestamp | date(format="%H:%M") }}
{% else %}
{{ g.keyValues | json_encode() }}: {{ alert.timestamp | date(format="%Y-%m-%d %H:%M") }}
{% endif %}
{% endfor %}
Full example payload
A logs threshold alert that triggered for one group:
{
"alertDef": {
"name": "Compute errors high",
"description": "More than 10 errors in 5 minutes",
"entityLabels": { "team": "compute" },
"incidentSettings": { "retriggeringPeriod": { "minutes": 15 }, "notifyOn": "Triggered" },
"type": "logsThreshold",
"priority": "P5",
"groupByKeys": ["region", "service"],
"createdTime": 1700000000,
"updatedTime": 1700003600,
"id": "123e4567-e89b-12d3-a456-426614174000",
"alertVersionId": "abcdef12-3456-7890-abcd-ef1234567890",
"typeDefinition": {
"$type": "logsThreshold",
"logsThreshold": {
"notificationPayloadFilter": ["ERROR", "CRITICAL"],
"applicationName": [{ "value": "compute-service", "operation": "Is" }],
"subsystemName": [{ "value": "monitoring", "operation": "Is" }],
"severities": ["critical", "error"],
"luceneQuery": "status:ERROR OR status:CRITICAL",
"rules": [
{
"condition": {
"threshold": 10,
"timeWindow": { "logsTimeWindowSpecificValue": "5m" },
"conditionType": "More than threshold"
},
"override": { "priority": "P5" }
}
],
"undetectedValuesManagement": { "triggerUndetectedValues": true, "autoRetireTimeframe": "Never" }
}
}
},
"alert": {
"id": "123e4567-e89b-12d3-a456-426614174001",
"status": "Triggered",
"timestamp": 1700000000,
"highestPriority": "P5",
"groupingKey": "d2d2d0b3f8ffb26e7a0f8dbfb22d5764186e7f54621874bc1eb291b3a4e00d9b",
"alertDataUrl": "https://<your-team>.coralogix.com/#/insights?id=76c411be-ff4d-4fb1-a987-5fce042deaaf",
"hasNoData": false,
"statusBreakdown": { "totalGroupCount": 1, "totalTriggeredGroupCount": 1, "totalResolvedGroupCount": 0 },
"groups": [
{
"status": "Triggered",
"priority": "P5",
"keyValues": { "region": "us-east-1", "service": "compute-engine" },
"isNoData": false,
"details": {
"$type": "logsThreshold",
"logsThreshold": {
"fromTimestamp": 1699999700,
"toTimestamp": 1700000000,
"countResult": 15,
"isUndetectedValue": false,
"conditionType": "More than threshold",
"log": {
"dollarM": { "timestamp": "2023-11-14T22:13:20Z", "severity": "Error", "logID": "12345" },
"dollarL": { "applicationname": "compute-service", "subsystemname": "monitoring" },
"dollarD": { "message": "Task failed", "status": "ERROR" }
}
}
}
}
]
}
}
Common pitfalls
- Arrays: don't render
alert.groupsbare. Index it with[0], loop over it with{% for %}, or serialize it withjson_encode. - Type-specific fields:
alertDef.typeDefinition.<type>anddetails.<type>exist only for that alert type. A preset shared by several alert types fails to render when it reads a field another type doesn't have. Branch onalertDef.type, or guard withis definedordefault(...). - Missing log:
details.<type>.logis on one group at most. Guard it before reading. - Labels: read
alertDef.entityLabelsandkeyValuesdirectly, but index_context.entityLabelswith[0]. - Objects in JSON payloads: serialize with
json_encode() | safe.
For more patterns, see Tera usage.