如何使用 KQL 查询查询 Azure 中逻辑应用的状态

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

正如我在标题中提到的。我正在尝试获取我的订阅中可用的 LogicApp 的状态。为此,我使用以下查询。

KQL:

AzureDiagnostics 
| where type == "AzureActivity" 
| where ResourceResource == "MICROSOFT.LOGIC/workflows" 
| project LogicAppName, Status = tostring(todynamic(tostring(parse_json(Properties).state)).value) | summarize Enabled = countif(Status == "Enabled"), Disabled = countif(Status == "Disabled") by LogicAppName

但 AzureDiagnostics 似乎无法访问逻辑应用属性。还发现下面的 kql 查询也不起作用,因为我没有找到查询中提到的任何“资源”

resources 
| where type == "microsoft.logic/workflows"
| extend state = properties.state 
| extend trigger = properties.definition.triggers 
| extend createdTime = properties.createdTime 
| extend changedTime = properties.changedTime 
| extend connections = properties.parameters.$connections.value 
| project name, createdTime, changedTime, state, subscriptionId, connections, location, resourceGroup

有人可以帮我解决它吗?

azure azure-logic-apps kql azure-diagnostics
1个回答
0
投票

如何使用 KQL 查询查询 Azure 中逻辑应用的状态

您可以记录状态,但为此您需要将所有逻辑应用的日志发送到日志分析工作区,如下所示,然后进行 Kql 查询:

我已在我的环境中重现,下面是预期结果,并遵循SO-ThreadMicrosoft-document。:

首先在日志分析工作区中输入工作区摘要,如下所示:

enter image description here

然后单击Logic Apps Managemnet(预览):

enter image description here

然后单击创建并添加工作区名称:

enter image description here

然后转到创建的资源。

现在创建并打开日志的逻辑应用程序,在其中单击“诊断设置”并添加如下:

enter image description here

然后:

enter image description here

然后打开日志分析工作区并使用以下 Kql 查询工作流的状态:

AzureDiagnostics
| where ResourceProvider == "MICROSOFT.LOGIC"

因此,您需要将所有逻辑应用程序的日志发送到日志分析工作区,然后使用 Kql 查询。

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