Skip to main content

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.

Tip

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:

SourceTypeConditionStatusDescription
LogsLOGS_IMMEDIATEN/ATriggered / ResolvedAlert immediately when a log of interest is detected. Docs
LogsLOGS_THRESHOLDMore than / Less thanTriggered / ResolvedAlert when the sum of logs crosses a predefined threshold. Docs
LogsLOGS_RATIO_THRESHOLDMore than / Less thanTriggered / ResolvedAlert when the ratio between two log queries reaches a set threshold. Docs
LogsLOGS_TIME_RELATIVE_THRESHOLDMore than / Less thanTriggered / ResolvedAlerts when a fixed ratio reaches a set threshold compared to a past time frame. Docs
LogsLOGS_ANOMALYMore than usualTriggered / ResolvedAlert when a log crosses an AI-generated baseline. Docs
LogsLOGS_NEW_VALUEN/ATriggeredAlert on a newly detected value in a time series. Docs
LogsLOGS_UNIQUE_COUNTMore thanTriggeredAlert based on a unique value count per key. Docs
MetricsMETRIC_THRESHOLDMore than / Less than / More than or equals / Less than or equalsTriggered / ResolvedAlert when a metric crosses a predefined threshold. Docs
MetricsMETRIC_ANOMALYMore than usual / Less than usual/Triggered /ResolvedAlert when a metric crosses an AI-generated baseline. Docs
TracingTRACING_IMMEDIATEN/ATriggeredAlert immediately when span duration exceeds a set latency. Docs
TracingTRACING_THRESHOLDMore thanTriggeredAlert when trace latency crosses a predefined threshold. Docs
FlowFLOWN/ATriggered / ResolvedAlert 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​

NamespaceWhat it holdsUse 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-levelFlat shortcuts: correlationKey, name, priority.Integrations that expect a flat field, such as a deduplication key.

alertDef.*: the alert definition​

PathTypeDescriptionExample
alertDef.namestringAlert name. Template expressions in the name are rendered before the payload is built.CPU usage high
alertDef.descriptionstringAlert description. Template expressions are rendered, as for the name.CPU above 90% for 5 minutes
alertDef.idstringAlert definition ID. Use it to build a link to the alert.123e4567-e89b-12d3-a456-426614174000
alertDef.alertVersionIdstringID of the alert definition version that fired.
alertDef.typestringAlert type. Matches the $type in alertDef.typeDefinition.logsThreshold, metricThreshold, flow
alertDef.prioritystringPriority set on the definition.P2
alertDef.entityLabelsobjectThe alert's labels, as { key: value }. Read a value directly.{{ alertDef.entityLabels["team"] }}
alertDef.groupByKeysarray of stringsThe alert's group-by keys.["host", "region"]
alertDef.incidentSettings.notifyOnstringWhen the alert notifies.Triggered
alertDef.incidentSettings.retriggeringPeriod.minutesnumberMinimum minutes between notifications for the same group.15
alertDef.createdTime, alertDef.updatedTimenumberWhen the definition was created and last changed, in Unix seconds.1700000000
alertDef.typeDefinitionobjectThe type-specific configuration. See Alert type configuration.

alert.*: the alert event​

PathTypeDescriptionExample
alert.idstringAlert event ID.
alert.statusstringEvent status.Triggered, Resolved
alert.timestampnumberWhen the event happened, in Unix seconds. Format it with the date filter.{{ alert.timestamp | date(format="%Y-%m-%d %H:%M") }}
alert.highestPrioritystringHighest priority across the event's groups.P1
alert.groupingKeystringStable key for the alert and its groups. The same problem produces the same key, so use it to deduplicate in the destination.d2d2d0b3f8ff...
alert.alertDataUrlstringLink to the event in Coralogix.
alert.editAlertUrlstringLink to the alert definition.
alert.logsExploreUrlstringLink to the matching logs in Explore, when the alert has one.
alert.hasNoDatabooleantrue when any group fired because data stopped arriving.false
alert.statusBreakdown.totalGroupCountnumberHow many groups the event covers.12
alert.statusBreakdown.totalTriggeredGroupCountnumberHow many of them are triggered.3
alert.statusBreakdown.totalResolvedGroupCountnumberHow many of them are resolved.9
alert.groupsarrayOne 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.

PathTypeDescriptionExample
alert.groups[N].keyValuesobjectThe group's group-by values, as { key: value }. Read a value directly.{{ alert.groups[0].keyValues["host"] }}
alert.groups[N].statusstringStatus of this group.Triggered
alert.groups[N].prioritystringPriority of this group.P3
alert.groups[N].isNoDatabooleantrue when this group fired because data stopped arriving.false
alert.groups[N].detailsobjectWhat the evaluation found for this group. See Group details by alert type.
Note

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.

$typeMain fields under alertDef.typeDefinition.<type>
logsImmediateluceneQuery, applicationName[], subsystemName[], severities[], notificationPayloadFilter[]
logsThresholdThe log filters above, plus rules[].condition.threshold, rules[].condition.timeWindow.logsTimeWindowSpecificValue, rules[].condition.conditionType, rules[].override.priority, undetectedValuesManagement
logsRatioThresholdnumerator and denominator (each with the log filters), numeratorAlias, denominatorAlias, rules[].condition.threshold, rules[].condition.timeWindow.logsRatioTimeWindowSpecificValue, rules[].condition.conditionType, rules[].override.priority, ignoreInfinity
logsTimeRelativeThresholdThe log filters, plus rules[].condition.threshold, rules[].condition.comparedTo, rules[].condition.conditionType, rules[].override.priority, ignoreInfinity, undetectedValuesManagement
logsAnomalyThe log filters, plus rules[].condition.minimumThreshold, rules[].condition.timeWindow.logsTimeWindowSpecificValue, anomalyAlertSettings.percentageOfDeviation
logsNewValueThe log filters, plus rules[].condition.keypathToTrack, rules[].condition.timeWindow.logsNewValueTimeWindowSpecificValue
logsUniqueCountThe log filters, plus uniqueCountKeypath, maxUniqueCountPerGroupByKey, rules[].condition.maxUniqueCount, rules[].condition.timeWindow.logsUniqueValueTimeWindowSpecificValue
metricThresholdpromql, rules[].condition.threshold, rules[].condition.forOverPct, rules[].condition.ofTheLast.metricTimeWindowSpecificValue, rules[].condition.conditionType, rules[].override.priority, missingValues, undetectedValuesManagement
metricAnomalypromql, rules[].condition.threshold, rules[].condition.forOverPct, rules[].condition.ofTheLast.metricTimeWindowSpecificValue, rules[].condition.minNonNullValuesPct, rules[].condition.conditionType, anomalyAlertSettings.percentageOfDeviation
tracingImmediateapplicationName[], subsystemName[], serviceName[], operationName[], spanFields[], latencyThresholdMs, notificationPayloadFilter[]
tracingThresholdThe tracing filters above, plus rules[].condition.spanAmount, rules[].condition.timeWindow.tracingTimeWindowValue, rules[].condition.conditionType, rules[].override.priority
sloThresholdsloDefinition.sloId, sloDefinition.name, sloDefinition.window, rules[].condition.threshold, rules[].override.priority
flowstages[].groups[].alertsOp, stages[].groups[].nextOp, stages[].timeframeMs, stages[].timeframeType, enforceSuppression
errorTrackingNewIssuequery, 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.

$typeFields under alert.groups[N].details.<type>
logsImmediatelog: the matching log. See The log object.
logsNewValuelog: the log with the new value.
logsThresholdcountResult, fromTimestamp, toTimestamp, conditionType, isUndetectedValue, log
logsRatioThresholdnumeratorCount, denominatorCount, ratio, fromTimestamp, toTimestamp, conditionType
logsTimeRelativeThresholdlatestCount, pastCount, ratio, fromTimestamp, toTimestamp, conditionType
metricThresholdavgValueOverThreshold, minValueOverThreshold, maxValueOverThreshold, pctOverThreshold, fromTimestamp, toTimestamp, conditionType, isUndetectedValue
tracingImmediatetraceId
tracingThresholdcount, fromTimestamp, toTimestamp
sloThresholdpctOverThreshold, fromTimestamp, toTimestamp, shortWindowOutput.pctOverThreshold
flowflowAlertsMatch[]: each matched stage, with from, to, and groups[] holding the events[] (alertId, eventId, timestamp) and resolvedAlerts[]
logsUniqueCountNo 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.

PathDescription
log.dollarDThe log body ($d). Read a field by name, for example log.dollarD.message.
log.dollarLThe log's labels ($l), such as applicationname and subsystemname.
log.dollarM.timestampLog timestamp, as an ISO 8601 string.
log.dollarM.severityLog severity.
log.dollarM.logIDLog ID.

For example: {{ alert.groups[0].details.logsImmediate.log.dollarD.message | default(value="") }}.

_context.*: the notification envelope​

PathDescriptionExample
_context.entityTypeAlways alerts for alert notifications.alerts
_context.entitySubTypeType, condition, and status in one string.metricThresholdMoreThanTriggered
_context.entityLabelsRouting labels. Array-shaped: index with [0]. For alerts, each array holds one value.{{ _context.entityLabels["team"][0] }}
_context.systemYour Coralogix team: id, name.{{ _context.system.name }}
_context.triggertype (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​

NameDescription
correlationKeyMirrors alert.groupingKey. Use it as the deduplication key for PagerDuty or ServiceNow-style integrations.
nameMirrors alertDef.name.
priorityMirrors 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.groups bare. Index it with [0], loop over it with {% for %}, or serialize it with json_encode.
  • Type-specific fields: alertDef.typeDefinition.<type> and details.<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 on alertDef.type, or guard with is defined or default(...).
  • Missing log: details.<type>.log is on one group at most. Guard it before reading.
  • Labels: read alertDef.entityLabels and keyValues directly, but index _context.entityLabels with [0].
  • Objects in JSON payloads: serialize with json_encode() | safe.

For more patterns, see Tera usage.

Next steps​

Last updated on