Kusto:查询获取http状态代码

问题描述 投票:0回答:1

我正在尝试查询 Azure 容器应用程序,以在 Http 状态代码为 400 时创建自定义警报。

我是 kusto 的新手。我尝试了以下查询:

CIEventsAudit
| where StatusCode == 400
| sort by TimeGenerated desc
| limit 100
azure-application-insights kql azure-container-apps
1个回答
0
投票

您的查询尝试是在正确的轨道上。

CIEventsAudit
是用于检索容器应用程序的 http 状态代码日志的表。

您已经尝试过的以下查询为您提供了仅限计数

100
(当日志具有http状态代码
400
时)的日志。并按
TimeGenerated
字段的降序对日志进行排序。

CIEventsAudit
| where StatusCode == 400
| sort by TimeGenerated desc
| limit 100

或者,您也可以使用以下查询来实现您的要求。

CIEventsAudit
| where OperationName contains "HttpRequest"
| where OperationStatus == 400
| sort by TimeGenerated desc
| limit 100 

添加完上述任一查询后,您可以使用

custom log search signal
创建警报规则,如下所示。 在
Actions
下,提供必要的操作组详细信息以满足您的要求。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.