Skip to main content

Alert Variables

Variables are used as parameters that allow you to customize the JSON payload object of your alert notifications. These variables dynamically populate specific values from the alert configuration in the notification payload. For example, the {{TriggerType}} variable provides the current monitor status in the notification. When a notification is sent, the variables are replaced with values from the alert. For instance, if you specify {{Name}} in your JSON payload, it will be replaced with the actual name of the alert in the delivered payload.

Common variables for alerts​

You can use the following built-in variables when specifying the notification payload for log and metric monitors andΒ Scheduled Searches. They allow you to reference specific configurations of your monitor.

The table below lists the variable descriptions along with which areas of the product you can use them.

Variables must be enclosed by double curly brackets ({{ }}). Unresolved variables are given empty quotes "" as a value. All variables areΒ case-insensitive.

VariableDescriptionMonitorsScheduled Searches
{{Name}}The name of the alert. In the delivered payload, this variable is replaced with the Name you assigned to the alert when you created it.βœ…βœ…
{{Description}}The description of the alert.βœ…βœ…
{{MonitorType}}The type of alert, either Logs or Metrics.βœ…βœ…
{{Query}}The query used to run the alert.βœ…βœ…
{{QueryURL}}The URL to the logs or metrics query within Sumo Logic.βœ…βœ…
{{ResultsJson}}JSON object containing the query results that triggered the alert. A maximum of 200 aggregate results or 10 raw messages for this field can be sent via webhook.βœ…βœ…
Not available with Email notifications
{{ResultsJson.fieldName}}The value of the specified field name. For example, the payload specification {{ResultsJson.client_ip}} had {{ResultsJson.errors}} errors would result in a subject line like this: 70.69.152.165 had 391 errors.

A maximum of 200 aggregate results or 10 raw messages for this field can be sent via webhook.

A field name must match (case-insensitive) the field from your search and must be alphanumeric characters, underscores, and spaces. If you have a field name that has an unsupported character, use the as operator to rename it.

You can return a specific result by providing an array index value in bracket notation such as {{ResultsJson.fieldName}}[0] to return the first result.

Reserved Fields
The following are reserved field names. They are generated by Sumo Logic during collection or search operations.
  • _raw - Message
  • _messagetime - Time
  • _sourceHost - Host
  • _sourceCategory - Category
  • _sourceName - Name
  • _collector - Collector
  • _timeslice
  • _signature
βœ…βœ…
Email notifications only return the first result.
{{NumQueryResults}}The number of results the query returned. Results can be raw messages, time-series, or aggregates.
An aggregate query returns the number of aggregate results; displayed in the Aggregates tab of the Search page.
A non-aggregate query returns the number of raw results; displayed in the Messages tab of the Log Search page.
βœ…βœ…
{{Id}}The unique identifier of the monitor or search that triggered the alert. For example, 00000000000468D5.βœ…βœ…
{{DetectionMethod}}This is the type of Detection Method used to detect alerts. Values are based on static or outlier triggers and data type, either logs or metrics. The value will be either LogsStaticCondition, MetricsStaticCondition, LogsOutlierCondition, MetricsOutlierCondition, LogsMissingDataCondition, MetricsMissingDataCondition, or StaticCondition (deprecated).βœ…βœ…
{{SloDashboardUrl}}The URL to the SLO dashboard.βœ…βœ…
{{TriggerType}}The status of the alert or recovery. Alert will have either Normal, Critical, Warning, or Missing Data. Recovery will have either ResolvedCritical, ResolvedWarning, or ResolvedMissingData.βœ…βŒ
{{TriggerTimeRange}}The time range of the query that triggered the alert. For example, 07/13/2021 03:21:32 PM UTC to 07/13/2021 03:36:32 PM UTCβœ…βœ…
{{TriggerCondition}}The condition that triggered the alert. For example, Greater than or equal to 1.0 in the last 15 minutesβœ…βœ…
{{TriggerValue}}The value that triggered the alert.βœ…βœ…
{{TriggerTimeStart}}The start time of the time range that triggered the monitor in Unix format. For example, 1626189692042.βœ…βœ…
{{TriggerTimeEnd}}The end time of the time range that triggered the monitor in Unix format. For example, 1626190592042.βœ…βœ…
{{SourceURL}}The URL to the configuration or status page of the monitor in Sumo Logic.βœ…βŒ
{{AlertResponseUrl}}When your monitor is triggered, it will generate a URL and provide it as the value of this variable where you can use it to open alert response.βœ…βŒ
{{AlertName}}Name of the alert that will be displayed on the alert page.βœ…βœ…
{{Playbook}}Allows you to access the playbook content configured as part of your initial monitor setup.βœ…βœ…
Legacy variables

Here are legacy variables available for alert notifications from metrics monitors andΒ Scheduled Searches.

Click to view
VariablesDescriptionMetrics MonitorsScheduled Searches
{{SearchName}}Description of the saved search or monitor. In the delivered payload, this variable is replaced with the Name you assigned to the search or monitor when you created it.βœ…βœ…
{{SearchDescription}}Description of the saved search or monitor. In the delivered payload, this variable is replaced by the Description you assigned to the search or monitor when you created it.βœ…βœ…
{{SearchQuery}}The query used to run the saved search. In the delivered payload, this variable is replaced by your saved search query or metric query.βœ…βœ…
{{SearchQueryUrl}}The URL to the search or metrics query. In the delivered payload, this is a URL that you can click to run the saved logs or metric query.βœ…βœ…
{{TimeRange}}The time range that triggered the alert.βœ…βœ…
{{FireTime}}The start time of the log search or metric query that triggered the notification.βœ…βœ…
{{AggregateResultsJson}}JSON object containing search aggregation results. A maximum of 200 aggregate results can be sent via webhook.βŒβœ…
Not available with Email notifications
{{RawResultsJson}}JSON object containing raw messages. A maximum of 10 raw messages can be sent via webhook.βŒβœ…
Not available with Email notifications
{{NumRawResults}}Number of results returned by the search.βŒβœ…
{{Results.fieldname}}The value returned from the search result for the specified field. For example, this payload specification:
{{Results.client_ip}} had {{Results.errors}} errors
Results in a subject line like this:
70.69.152.165 had 391 errors
A maximum of 200 aggregate results or 10 raw messages for this field can be sent via webhook.
A field name must match (case-insensitive) the field from your search and must be alphanumeric characters, underscores, and b. If you have a field name that has an unsupported character use the as operator to rename it.
βœ…βœ…
{{AlertThreshold}}The condition that triggered the alert (for example, above 90 at least once in the last 5 minutes)βœ…βŒ
{{AlertSource}}The metric and sourceHost that triggered the alert, including associated tags for that metric.βœ…βŒ
{{AlertGroup}}The alert grouping that triggered the alert, including associated values for that metric.βœ…βŒ
{{AlertSource.fieldname}}The value returned from the AlertSource object for the specified field name.βœ…βŒ
{{AlertID}}The ID of the triggered alert.βœ…βŒ
{{AlertStatus}}Current status of the time series that triggered (for example, Critical or Warning).βœ…βŒ
{{AlertCondition}}The condition that triggered the alert.βŒβœ…

Examples​

Slack payload​

{
"attachments": [
{
"pretext": "Sumo Logic Alert for: *{{Name}}* by user USERNAME",
"fields": [
{
"title": "Description",
"value": "{{Description}} {{TriggerTimeStart}}"
},
{
"title": "Query",
"value": "<{{QueryURL}}|{{Query}}>"
},
{
"title": "Time Range",
"value": "{{TriggerTimeRange}}"
}
],
"mrkdwn_in": ["text", "pretext"],
"color": "#29A1E6"
}
]
}

PagerDuty payload​

{
"service_key": "xxxxx",
"event_type": "trigger",
"description": "Monitor Alert on {{Name}}",
"client": "Sumo Logic",
"details": {
"name": "{{Name}}",
"query": "<{{QueryURL}} | {{Query}}>",
"time": "{{TriggerTimeRange}} -- {{TriggerTime}} --"
}
}

Email message​

Monitor Alert: {{TriggerTimeRange}} on {{Name}}
Status
Legal
Privacy Statement
Terms of Use

Copyright Β© 2024 by Sumo Logic, Inc.