Resource type | resource_name field | record_id field | record_tag field | Example | Remarks |
User | sls.common.user | user_id | user_name | {
"user_id": "alex",
"user_name": "Alex",
"email": [
"***@example.com"
],
"country_code": "86",
"phone": "133********3333",
"enabled": true,
"sms_enabled": true,
"voice_enabled": true
}
| None. |
User group | sls.common.user_group | user_group_id | user_group_name | {
"user_group_id": "devops",
"user_group_name": "DevOps Team",
"enabled": true,
"members": [
"alex"
]
}
| None. |
On-duty group | sls.alert.oncall_group | oncall_id | oncall_name | {
"oncall_id": "default_oncall",
"oncall_name": "Default Oncall",
"enabled": true,
"overrides": [],
"rotations": [
{
"targets": [
{
"type": "user",
"target_id": "alex"
},
{
"type": "user_group",
"target_id": "devops"
}
],
"end_time": 0,
"shift_day": "",
"shift_time": "12:00",
"shift_type": "day",
"start_time": 1633017600,
"shift_minute": 0,
"end_time_type": "none",
"shift_interval": 1,
"shift_week_custom": null,
"restriction_date_type": "workday",
"restriction_time_type": "allday",
"restriction_week_range": null,
"restriction_time_custom_range": null
}
],
"calendar_id": "default_calendar"
}
| This configuration is complex. We recommend that you complete the configuration in the Simple Log Service console. |
Webhook integration | sls.alert.action_webhook | id | name | {
"id": "custom-webhook",
"name": "Custom Webhook",
"type": "custom",
"url": "http://localhost:9099/data/webhook",
"method": "POST",
"headers": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Foo",
"value": "bar"
}
]
}
{
"id": "dingtalk",
"name": "Dingtalk Webhook",
"type": "dingtalk",
"url": "https://oapi.dingtalk.com/robot/send?access_token=**********",
"method": "POST",
"secret": "SEC**********",
"headers": []
}
| Set type to the type of the webhook. Valid values: For all the types except custom, set method to POST and headers to an empty array. If you set type to dingtalk and select Additional Signature for Security Settings when you create a DingTalk chatbot or if you set type to lark and select Set signature verification for Security settings when you create a Lark bot, you must add the secret field. You can obtain the value of the secret field on the chatbot management page of DingTalk or the bot management page of Lark.
|
Alert policy | sls.alert.alert_policy | policy_id | policy_name | {
"policy_id": "sls.builtin",
"policy_name": "SLS Builtin Alert Policy",
"parent_id": "sls.root",
"is_default": false,
"group_script": "fire(action_policy=\"sls.builtin\", group={\"project\": \"__a__\", \"uid\": alert.aliuid}, group_wait=\"5s\", group_interval=\"2m\", repeat_interval=\"2m\")\nstop()\nfire(action_policy=\"sls.builtin\", group={\"alert_id\": alert.alert_id}, group_wait=\"5s\", group_interval=\"10s\", repeat_interval=\"2m\")\nif alert.labels.name ~= \"^\\\\w+s$\":\n\tfire(action_policy=\"sls.builtin\", group={\"product\": \"xxs\"}, group_wait=\"5s\", group_interval=\"10s\", repeat_interval=\"2m\")\n\tstop()\nstop()\nfire(action_policy=\"sls.builtin\", group={\"label_name\": alert.labels.name}, group_wait=\"10s\", group_interval=\"10s\", repeat_interval=\"2m\")",
"inhibit_script": "if alert.severity >= 8:\n silence alert.severity < 6",
"silence_script": ""
}
| Set is_default to false. Set group_script to a merge policy. Set inhibit_script to an inhibition policy. Set silence_script to a silence policy. If you use an SDK to perform the configuration, group_script, inhibit_script, and silence_script include only domain-specific language (DSL) script information and do not include UI configuration information. Therefore, you cannot view the graphical structure of the alert policy in the Simple Log Service console.
|
Action policy | sls.alert.action_policy | action_policy_id | action_policy_name | {
"action_policy_id": "sls.builtin",
"action_policy_name": "SLS Builtin Action Policy",
"labels": {},
"is_default": false,
"primary_policy_script": "fire(type=\"webhook_integration\", integration_type=\"dingtalk\", webhook_id=\"dingtalk-test\", template_id=\"default-template\", period=\"any\")",
"secondary_policy_script": "fire(type=\"voice\", users=[\"jizhi\"], groups=[\"group-jizhi\"], template_id=\"default-template\")",
"escalation_start_enabled": false,
"escalation_start_timeout": "10s",
"escalation_inprogress_enabled": false,
"escalation_inprogress_timeout": "10s",
"escalation_enabled": false,
"escalation_timeout": "4h0m0s"
}
| Set is_default to false. Set labels to an empty object. labels is a reserved parameter. Set primary_policy_script to a primary action policy. Set secondary_policy_script to a secondary action policy. Set escalation_* to determine whether to enable a secondary action policy. For more information, see the configuration items in the Simple Log Service console. If you use an SDK to perform the configuration, primary_policy_script and secondary_policy_script include only DSL script information and do not include UI configuration information. Therefore, you cannot view the graphical structure of the action policy in the Simple Log Service console.
|
Alert template | sls.alert.content_template | template_id | template_name | {
"template_id": "default-template",
"template_name": "Default Template",
"is_default": false,
"templates": {
"fc": {
"limit": 0,
"locale": "zh-CN",
"content": "",
"send_type": "merged"
},
"sms": {
"locale": "zh-CN",
"content": ""
},
"lark": {
"title": "Alerthub alert test ${alert_name}",
"locale": "zh-CN",
"content": ""
},
"email": {
"locale": "zh-CN",
"content": "",
"subject": "SLS alert test-jizhi-test"
},
"slack": {
"title": "Alerthub alert test ${alert_name}",
"locale": "zh-CN",
"content": ""
},
"voice": {
"locale": "zh-CN",
"content": ""
},
"wechat": {
"title": "Alerthub alert test ${alert_name}",
"locale": "zh-CN",
"content": ""
},
"webhook": {
"limit": 0,
"locale": "zh-CN",
"content": "",
"send_type": "batch"
},
"dingtalk": {
"title": "Alerthub alert test ${alert_name}",
"locale": "zh-CN",
"content": ""
},
"event_bridge": {
"locale": "zh-CN",
"content": "",
"subject": "wkb-test"
},
"message_center": {
"locale": "zh-CN",
"content": ""
}
}
}
| Set is_default to false. Set templates to the alert templates for each notification method that you want to use. If content is empty for a notification method, the default alert template is used for the notification method. For more information, see Default alert templates. Set locale to zh-CN or en-US. For the webhook and fc notification methods, set send_type to single or batch. The value single indicates that Simple Log Service sends notifications for each alert. The value batch indicates that Simple Log Service merges alerts into an alert set and sends only one notification for the alert set.
|
Default calendar | sls.common.calendar | calendar_id | calendar_name | {
"calendar_id": "default_calendar",
"calendar_name": "Default Calendar",
"timezone": "Asia/Shanghai",
"workdays": [
1,
2,
3,
4,
5
],
"worktime": [
{
"end_time": "21:00",
"start_time": "09:00"
}
],
"reset_days": [],
"holiday_sync": "china"
}
| |