Template variables for legacy alerts
Updated at:
This topic describes the template variables that legacy alerts support and how to reference them.
Reference Principles
When you configure a notification method, you can reference template variables in the Content and Subject fields using the ${fieldName} syntax. When Simple Log Service sends an alert notification, it replaces these variables with their actual values. For example, Simple Log Service replaces ${Project} with the name of the project to which the alert rule belongs.
Important The variable name must be an exact match. If a referenced variable does not exist or is invalid, it is rendered as an empty string. If the value of a referenced variable is an object, the value is converted to a JSON string.
Available variables and references
| Variable | Description | Example of Message Content and Alert Subject Configuration | Alert notification example |
| Aliuid | The ID of the Alibaba Cloud account to which the project belongs. | An alert rule was triggered for user ${Aliuid}. | An alert rule was triggered for user 117914634953****. |
| Project | The project to which the alert rule belongs. | An alert rule in the ${Project} project was triggered. | An alert rule in the my-project project was triggered. |
| AlertID | The ID of the alert. | The alert ID is ${AlertID}. | The alert ID is 0fdd88063a611aa114938f9371daeeb6-1671a52****. |
| AlertName | The name of the alert rule. The name is unique within a project. | The ${AlertName} alert rule was triggered. | The alert-1542111415-153472 alert rule was triggered. |
| AlertDisplayName | The display name of the alert rule. | The ${AlertDisplayName} alert was triggered. | The website monitoring alert was triggered. |
| Condition | The conditional expression that triggers the alert. In the alert notification, the variable is replaced with the actual value and enclosed in brackets ([]). | The conditional expression is ${Condition}. | The conditional expression is [5] > 1. |
| RawCondition | The original conditional expression that triggers the alert. | The original conditional expression is ${RawCondition}. | The original conditional expression is count > 1. |
| Dashboard | The name of the dashboard associated with the alert. | The associated dashboard is ${Dashboard}. | The associated dashboard is mydashboard. |
| DashboardUrl | The URL of the dashboard associated with the alert. | The URL of the associated dashboard is ${DashboardUrl}. | The URL of the associated dashboard is https://sls.console.aliyun.com/next/project/myproject/dashboard/mydashboard. |
| FireTime | The time when the alert was triggered. | The alert was triggered at ${FireTime}. | The alert was triggered at 2021-01-02 15:04:05. |
| FullResultUrl | The URL to query the alert history. | Click ${FullResultUrl} to view alert details. | Click https://sls.console.aliyun.com/next/project/my-project/logsearch/internal-alert-history?endTime=1544083998&queryString=AlertID%3A9155ea1ec10167985519fccede4d5fc7-1678293caad&queryTimeType=99&startTime=1544083968 to view alert details. |
| Results | The parameters and results of the query and analysis. This variable is an array. The following code provides an example: Note Results variable can contain up to 100 pieces of alert information. For more information, see Alert log fields. | The start time of the first query and analysis is ${Results[0].StartTime}, and the end time is ${Results[0].EndTime}. Note In this example, 0 is the chart ID. For more information about how to obtain the chart ID, see View chart IDs. | The start time of the first query and analysis is 2021-05-21 18:18:12, and the end time is 2021-05-21 18:33:12. |
Is this page helpful?