Zhu
Zhu

Reputation: 3905

How to query the status of the logic app in Azure using KQL queries

AS I mentioned in the title. I am trying to get the Status of the LogicApps available in my subscription. For that am using the below query.

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

But AzureDiagnostics does not have the access to logic app properties it seems. also found the below kql query that's also not worked as I didn't find any 'resources' as mentioned in the query

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

can somebody help me to fix it .

Upvotes: 0

Views: 1498

Answers (1)

RithwikBojja
RithwikBojja

Reputation: 11383

How to query the status of the logic app in Azure using KQL queries

You can log the status, but for that you need to send your logs of all logic apps to Log analytics workspace as below and then Kql query:

I have reproduced in my environment and below are expected results and followed SO-Thread and Microsoft-document.:

Firstly type workspace summary in Log analytics workspace as below:

enter image description here

Then click on Logic Apps Managemnet(Preview):

enter image description here

Then click on create and add name of the workspace:

enter image description here

Then go to the resource that is created.

Now the logic app which is created and have logs open that, In that click on Diagnostic settings and add it as below:

enter image description here

Then:

enter image description here

Then wait for sometime for the logs to get into Log analytics workspace and then open your log analytics workspace and use the below Kql query to the status of workflow:

AzureDiagnostics
| where ResourceProvider == "MICROSOFT.LOGIC"
| where OperationName contains "workflowRun"

enter image description here

enter image description here

So, You need to send logs of all Logic apps to Log analytic workspace and then use the Kql query.

Upvotes: 0

Related Questions