Scheduled Query Rules - Update
更新日志搜索规则。
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}?api-version=2018-04-16
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
resource
|
path | True |
string minLength: 1maxLength: 90 |
资源组的名称。 名称不区分大小写。 |
|
rule
|
path | True |
string |
规则的名称。 |
|
subscription
|
path | True |
string minLength: 1 |
目标订阅的 ID。 |
|
api-version
|
query | True |
string minLength: 1 |
用于此作的 API 版本。 |
请求正文
| 名称 | 类型 | 说明 |
|---|---|---|
| properties.enabled |
指示是否启用日志搜索规则的标志。 值应为 true 或 false |
|
| tags |
object |
资源标记 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 200 OK |
成功请求更新日志搜索规则 |
|
| Other Status Codes |
描述作失败的原因的错误响应。 |
安全性
azure_auth
Azure Active Directory OAuth2 流
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
| 名称 | 说明 |
|---|---|
| user_impersonation | 模拟用户帐户 |
示例
Patch Log Search Rule
示例请求
PATCH https://management.azure.com/subscriptions/subid/resourcegroups/my-resource-group/providers/Microsoft.Insights/scheduledQueryRules/logalertfoo?api-version=2018-04-16
{
"properties": {
"enabled": "true"
}
}
示例响应
{
"id": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/scheduledQueryRules/logalertfoo",
"name": "logalertfoo",
"type": "Microsoft.Insights/scheduledQueryRules",
"location": "West US",
"tags": {},
"properties": {
"description": "log alert description",
"enabled": "true",
"lastUpdatedTime": "2017-06-23T21:23:52.0221265Z",
"provisioningState": "Succeeded",
"source": {
"query": "requests",
"dataSourceId": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI",
"queryType": "ResultCount"
},
"schedule": {
"frequencyInMinutes": 15,
"timeWindowInMinutes": 15
},
"action": {
"odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction",
"severity": "1",
"aznsAction": {
"actionGroup": [],
"emailSubject": "Email Header",
"customWebhookPayload": "{}"
},
"trigger": {
"thresholdOperator": "GreaterThan",
"threshold": 3,
"metricTrigger": {
"thresholdOperator": "GreaterThan",
"threshold": 5,
"metricTriggerType": "Consecutive",
"metricColumn": "ColumnName"
}
}
}
}
}
定义
| 名称 | 说明 |
|---|---|
|
Alerting |
指定规则类型为 Alert 时需要执行的作 |
|
Alert |
警报的严重性级别 |
|
Az |
Azure作组 |
|
Conditional |
结果条件评估条件。 |
| Criteria |
指定将日志转换为指标的条件。 |
| Dimension |
指定将日志转换为指标的条件。 |
| enabled |
指示是否启用日志搜索规则的标志。 值应为 true 或 false |
|
Error |
描述错误响应的格式。 |
|
Error |
描述错误响应的格式。 |
|
Log |
日志指标触发器描述符。 |
|
Log |
日志搜索规则资源。 |
|
Log |
用于修补作的日志搜索规则资源。 |
|
Log |
当规则类型将日志转换为指标时,需要执行指定作 |
|
metric |
指标触发器类型 - “连续” 或 “Total” |
| operator |
维度值的运算符 |
|
provisioning |
计划查询规则的预配状态 |
|
Query |
将值设置为“ResultAccount” |
| Schedule |
定义运行搜索的频率和时间间隔。 |
| Source |
指定日志搜索查询。 |
|
Trigger |
导致日志搜索规则的条件。 |
AlertingAction
指定规则类型为 Alert 时需要执行的作
| 名称 | 类型 | 说明 |
|---|---|---|
| aznsAction |
Azure 操作组参考。 |
|
| odata.type |
string:
Microsoft. |
指定操作。 支持的值 - AlertingAction、LogToMetricAction |
| severity |
警报的严重性 |
|
| throttlingInMin |
integer (int32) |
应限制或禁止警报的时间(以分钟为单位)。 |
| trigger |
导致警报规则的触发器条件。 |
AlertSeverity
警报的严重性级别
| 值 | 说明 |
|---|---|
| 0 | |
| 1 | |
| 2 | |
| 3 | |
| 4 |
AzNsActionGroup
Azure作组
| 名称 | 类型 | 说明 |
|---|---|---|
| actionGroup |
string[] |
Azure 操作组参考。 |
| customWebhookPayload |
string |
要为 Azure 操作组中的所有 Webhook URI 发送的自定义有效负载 |
| emailSubject |
string |
Azure 操作组中所有电子邮件 ID 的自定义主题替代 |
ConditionalOperator
结果条件评估条件。
| 值 | 说明 |
|---|---|
| GreaterThanOrEqual | |
| LessThanOrEqual | |
| GreaterThan | |
| LessThan | |
| Equal |
Criteria
指定将日志转换为指标的条件。
| 名称 | 类型 | 说明 |
|---|---|---|
| dimensions |
用于创建指标的维度列表 |
|
| metricName |
string |
指标的名称 |
Dimension
指定将日志转换为指标的条件。
| 名称 | 类型 | 说明 |
|---|---|---|
| name |
string |
维度的名称 |
| operator |
维度值的运算符 |
|
| values |
string[] |
维度值列表 |
enabled
指示是否启用日志搜索规则的标志。 值应为 true 或 false
| 值 | 说明 |
|---|---|
| true | |
| false |
ErrorContract
描述错误响应的格式。
| 名称 | 类型 | 说明 |
|---|---|---|
| error |
错误详细信息。 |
ErrorResponse
描述错误响应的格式。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
错误代码 |
| message |
string |
指示操作失败的原因的错误消息。 |
LogMetricTrigger
日志指标触发器描述符。
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| metricColumn |
string |
评估特定列的指标 |
|
| metricTriggerType | Consecutive |
指标触发器类型 - “连续” 或 “Total” |
|
| threshold |
number (double) |
指标触发器的阈值。 |
|
| thresholdOperator | GreaterThanOrEqual |
指标的评估操作 -“GreaterThan”或“LessThan”或“Equal”。 |
LogSearchRuleResource
日志搜索规则资源。
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| etag |
string |
etag 字段 不需要。 如果在响应正文中提供,则还必须根据正常的 etag 约定将其作为标头提供。 实体标记用于比较同一请求资源的两个或多个实体。 HTTP/1.1 在 etag(第 14.19 节)、If-Match(第 14.24 节)、If-None-Match(第 14.26 节)和 If-Range(第 14.27 节)标头字段中使用实体标记。 |
|
| id |
string |
Azure 资源 ID |
|
| kind |
string |
门户/工具等用于为相同类型的资源呈现不同的 UX 体验的元数据;例如,ApiApps 是一种 Microsoft.Web/sites 类型。 如果受支持,资源提供程序必须验证并保留此值。 |
|
| location |
string |
资源位置 |
|
| name |
string |
Azure 资源名称 |
|
| properties.action | Action: |
需要对规则执行执行操作。 |
|
| properties.autoMitigate |
boolean |
False |
指示是否应自动解决警报的标志。 默认值为 false。 |
| properties.createdWithApiVersion |
string |
创建此警报规则时使用的 API 版本 |
|
| properties.description |
string |
日志搜索规则的说明。 |
|
| properties.displayName |
string |
警报规则的显示名称 |
|
| properties.enabled |
指示是否启用日志搜索规则的标志。 值应为 true 或 false |
||
| properties.isLegacyLogAnalyticsRule |
boolean |
如此 如果警报规则是旧版 Log Analytic 规则 |
|
| properties.lastUpdatedTime |
string (date-time) |
上次以IS08601格式更新规则的时间。 |
|
| properties.provisioningState |
计划查询规则的预配状态 |
||
| properties.schedule |
规则的计划(频率、时间窗口)。 操作类型必需 - AlertingAction |
||
| properties.source |
数据源将针对哪个规则查询数据 |
||
| tags |
object |
资源标记 |
|
| type |
string |
Azure 资源类型 |
LogSearchRuleResourcePatch
用于修补作的日志搜索规则资源。
| 名称 | 类型 | 说明 |
|---|---|---|
| properties.enabled |
指示是否启用日志搜索规则的标志。 值应为 true 或 false |
|
| tags |
object |
资源标记 |
LogToMetricAction
当规则类型将日志转换为指标时,需要执行指定作
| 名称 | 类型 | 说明 |
|---|---|---|
| criteria |
Criteria[] |
指标条件 |
| odata.type |
string:
Microsoft. |
指定操作。 支持的值 - AlertingAction、LogToMetricAction |
metricTriggerType
指标触发器类型 - “连续” 或 “Total”
| 值 | 说明 |
|---|---|
| Consecutive | |
| Total |
operator
维度值的运算符
| 值 | 说明 |
|---|---|
| Include |
provisioningState
计划查询规则的预配状态
| 值 | 说明 |
|---|---|
| Succeeded | |
| Deploying | |
| Canceled | |
| Failed |
QueryType
将值设置为“ResultAccount”
| 值 | 说明 |
|---|---|
| ResultCount |
Schedule
定义运行搜索的频率和时间间隔。
| 名称 | 类型 | 说明 |
|---|---|---|
| frequencyInMinutes |
integer (int32) |
应评估规则条件的频率(以分钟为单位)。 |
| timeWindowInMinutes |
integer (int32) |
需要为查询提取数据的时间范围(应大于或等于 frequencyInMinutes)。 |
Source
指定日志搜索查询。
| 名称 | 类型 | 说明 |
|---|---|---|
| authorizedResources |
string[] |
查询中引用的资源列表 |
| dataSourceId |
string |
要对其运行日志搜索查询的资源 URI。 |
| query |
string |
日志搜索查询。 操作类型必需 - AlertingAction |
| queryType |
将值设置为“ResultCount”。 |
TriggerCondition
导致日志搜索规则的条件。
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| metricTrigger |
指标查询规则的触发器条件 |
||
| threshold |
number (double) |
基于应触发规则的结果或计数阈值。 |
|
| thresholdOperator | GreaterThanOrEqual |
规则的评估操作 - “GreaterThan”或“LessThan”。 |