Alert notification content FAQ

更新时间:
复制 MD 格式

Answers common questions about alert notification content, including template variables, content truncation, data formatting, and rendering errors.

How do I reference log content in a notification?

Select a variable such as labels, annotations, fire_results, or results in your content template. Reference log content in an alert notification.

How do I display trigger log content in a notification?

Alert-triggering query and analysis results are stored in the fire_results variable. Use it to display trigger log content in notifications. Content template syntax (New) and Content template variables (New).

Method

Description

Display as a JSON string

{{ alert.fire_results | to_json }}

Format output with known fields

{%- for result in alert.fire_results %}
- {{ result.field1 }}
- {{ result.field2 }}
- {{ result['__tag__:_field3_'] }}
{%- endfor %}

Format output with unknown fields

{%- for result in alert.fire_results %}
{%- for key, val in result.items() %}
- {{ key }}: {{ val }}
{%- endfor %}
{%- endfor %}

What if alert notifications display truncated content?

Alert messages have a length limit. If the fire_results value exceeds 2 KB or any field in the fire_results results exceeds 1 KB, content is truncated. To view complete data, add the query_url variable to your content template and click the link to open the Query & Analysis page in the SLS console. Examples:

  • For Markdown templates (DingTalk), use [View Details]({{ alert.query_url }}).

  • For HTML templates (email), use <a href="{{ alert.query_url }}">View Details</a>.

How do I format and process data in a content template?

Use Built-in template functions to format content, process strings, and calculate data in notifications. If these functions do not meet your requirements, submit a ticket to contact SLS technical support.

How do I fix a "Template render error: xxxx" fault?

The Template render error: xxxx fault indicates an invalid content template configuration. Check your configuration against the Content template syntax (New).

If the issue persists, submit a ticket to contact SLS technical support.