共用方式為


Scheduled Query Rules - Get

取得記錄搜尋規則

GET https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}?api-version=2018-04-16

URI 參數

名稱 位於 必要 類型 Description
resourceGroupName
path True

string

minLength: 1
maxLength: 90

資源群組的名稱。 名稱不區分大小寫。

ruleName
path True

string

規則的名稱。

subscriptionId
path True

string

minLength: 1

目標訂用帳戶的標識碼。

api-version
query True

string

minLength: 1

要用於這項作業的 API 版本。

回應

名稱 類型 Description
200 OK

LogSearchRuleResource

取得記錄搜尋規則的成功要求

Other Status Codes

ErrorContract

描述作業失敗原因的錯誤回應。

安全性

azure_auth

Azure Active Directory OAuth2 Flow

類型: oauth2
Flow: implicit
授權 URL: https://login.microsoftonline.com/common/oauth2/authorize

範圍

名稱 Description
user_impersonation 模擬您的用戶帳戶

範例

Get rule

範例要求

GET https://management.azure.com/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourcegroups/Rac46PostSwapRG/providers/Microsoft.Insights/scheduledQueryRules/logalertfoo?api-version=2018-04-16

範例回覆

{
  "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",
      "queryType": "ResultCount",
      "dataSourceId": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI"
    },
    "schedule": {
      "frequencyInMinutes": 15,
      "timeWindowInMinutes": 15
    },
    "action": {
      "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction",
      "severity": "1",
      "trigger": {
        "thresholdOperator": "GreaterThan",
        "threshold": 3
      },
      "aznsAction": {
        "actionGroup": [],
        "emailSubject": "Email Header",
        "customWebhookPayload": "{}"
      }
    }
  }
}

定義

名稱 Description
AlertingAction

指定規則類型為警示時必須採取的動作

AlertSeverity

警示嚴重性層級

AzNsActionGroup

Azure 動作群組

ConditionalOperator

結果條件評估準則。

Criteria

指定將記錄轉換成計量的準則。

Dimension

指定將記錄轉換成計量的準則。

enabled

指出是否啟用記錄搜尋規則的旗標。 值應該是 true 或 false

ErrorContract

描述錯誤回應的格式。

ErrorResponse

描述錯誤回應的格式。

LogMetricTrigger

記錄計量觸發描述元。

LogSearchRuleResource

記錄搜尋規則資源。

LogToMetricAction

當規則類型將記錄轉換成計量時,必須執行指定動作

metricTriggerType

計量觸發程序類型 - 'Consecutive' 或 'Total'

operator

維度值的運算符

provisioningState

排程查詢規則的布建狀態

QueryType

將值設定為 'ResultAccount'

Schedule

定義執行搜尋和時間間隔的頻率。

Source

指定記錄搜尋查詢。

TriggerCondition

導致記錄搜尋規則的條件。

AlertingAction

指定規則類型為警示時必須採取的動作

名稱 類型 Description
aznsAction

AzNsActionGroup

Azure 動作群組參考。

odata.type string:

Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction

指定動作。 支援的值 - AlertingAction、LogToMetricAction

severity

AlertSeverity

警示的嚴重性

throttlingInMin

integer (int32)

警示應進行節流或隱藏的時間(以分鐘為單位)。

trigger

TriggerCondition

導致警示規則的觸發條件。

AlertSeverity

警示嚴重性層級

Description
0
1
2
3
4

AzNsActionGroup

Azure 動作群組

名稱 類型 Description
actionGroup

string[]

Azure 動作群組參考。

customWebhookPayload

string

要針對 Azure 動作群組中所有 Webhook URI 傳送的自定義承載

emailSubject

string

Azure 動作群組中所有電子郵件標識碼的自定義主旨覆寫

ConditionalOperator

結果條件評估準則。

Description
Equal
GreaterThan
GreaterThanOrEqual
LessThan
LessThanOrEqual

Criteria

指定將記錄轉換成計量的準則。

名稱 類型 Description
dimensions

Dimension[]

用於建立計量的維度清單

metricName

string

計量的名稱

Dimension

指定將記錄轉換成計量的準則。

名稱 類型 Description
name

string

維度的名稱

operator

operator

維度值的運算符

values

string[]

維度值清單

enabled

指出是否啟用記錄搜尋規則的旗標。 值應該是 true 或 false

Description
false
true

ErrorContract

描述錯誤回應的格式。

名稱 類型 Description
error

ErrorResponse

錯誤詳細數據。

ErrorResponse

描述錯誤回應的格式。

名稱 類型 Description
code

string

錯誤碼

message

string

錯誤訊息,指出作業失敗的原因。

LogMetricTrigger

記錄計量觸發描述元。

名稱 類型 預設值 Description
metricColumn

string

評估特定數據行上的計量

metricTriggerType

metricTriggerType

Consecutive

計量觸發程序類型 - 'Consecutive' 或 'Total'

threshold

number (double)

計量觸發程式的臨界值。

thresholdOperator

ConditionalOperator

GreaterThanOrEqual

計量 -'GreaterThan' 或 'LessThan' 或 'Equal' 的評估作業。

LogSearchRuleResource

記錄搜尋規則資源。

名稱 類型 預設值 Description
etag

string

etag 欄位 不需要。 如果在回應本文中提供,則也必須根據一般 etag 慣例提供它作為標頭。 實體標籤用於比較來自相同要求資源的兩個或多個實體。 HTTP/1.1 會在 etag(第 14.19 節)、If-Match(第 14.24 節)、If-None-Match (section 14.26) 和 If-Range (第 14.27 節) 標頭字段中使用實體標記。

id

string

Azure 資源標識碼

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

enabled

指出是否啟用記錄搜尋規則的旗標。 值應該是 true 或 false

properties.isLegacyLogAnalyticsRule

boolean

True 是表示 如果警示規則是舊版 Log Analytic 規則

properties.lastUpdatedTime

string (date-time)

上次以IS08601格式更新規則的時間。

properties.provisioningState

provisioningState

排程查詢規則的布建狀態

properties.schedule

Schedule

規則的排程(頻率、時間範圍)。 動作類型的必要專案 - AlertingAction

properties.source

Source

數據源會根據哪個規則查詢數據

tags

object

資源標籤

type

string

Azure 資源類型

LogToMetricAction

當規則類型將記錄轉換成計量時,必須執行指定動作

名稱 類型 Description
criteria

Criteria[]

計量準則

odata.type string:

Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction

指定動作。 支援的值 - AlertingAction、LogToMetricAction

metricTriggerType

計量觸發程序類型 - 'Consecutive' 或 'Total'

Description
Consecutive
Total

operator

維度值的運算符

Description
Include

provisioningState

排程查詢規則的布建狀態

Description
Canceled
Deploying
Failed
Succeeded

QueryType

將值設定為 'ResultAccount'

Description
ResultCount

Schedule

定義執行搜尋和時間間隔的頻率。

名稱 類型 Description
frequencyInMinutes

integer (int32)

應該評估規則條件的頻率(以分鐘為單位)。

timeWindowInMinutes

integer (int32)

需要擷取查詢數據的時間範圍(應大於或等於 frequencyInMinutes)。

Source

指定記錄搜尋查詢。

名稱 類型 Description
authorizedResources

string[]

查詢中參考的資源清單

dataSourceId

string

要執行記錄搜尋查詢的資源 URI。

query

string

記錄搜尋查詢。 動作類型的必要專案 - AlertingAction

queryType

QueryType

將值設定為 'ResultCount' 。

TriggerCondition

導致記錄搜尋規則的條件。

名稱 類型 預設值 Description
metricTrigger

LogMetricTrigger

計量查詢規則的觸發條件

threshold

number (double)

應根據應觸發規則的結果或計數臨界值。

thresholdOperator

ConditionalOperator

GreaterThanOrEqual

規則的評估作業 - 'GreaterThan' 或 'LessThan。