sergioMoreno
sergioMoreno

Reputation: 354

Connector name from Kusto query

I am very new with the sintaxis of Kusto query. My goal is to create a kusto query to retreive which Logic App has a system error and in which action the error was located. Additionally, I would like to know which connector, this failed action belongs. For example, If the action "Move Email" failed I would like to have the connector name, in this case, Office 365 Outlook or something similar in order to classify the action.

My query to achieve this goal was based on the Table "AzureDiagnostics":

AzureDiagnostics
| where ResourceProvider == "MICROSOFT.LOGIC"
| where Category == "WorkflowRuntime"
| where status_s == "Failed"
| where code_s  !has 'ActionFailed'
| where OperationName has "workflowActionCompleted" or OperationName has "workflowTriggerCompleted"
| extend ResourceName = coalesce(resource_actionName_s, resource_triggerName_s)
| extend ResourceCategory = substring(OperationName, 34, strlen(OperationName) - 43)
| project
    LogicAppName = resource_workflowName_s,
    ResourceCategory,
    ResourceName,
    LogicAppId = resource_runId_s,
    ErrorCode = code_s,
    ErrorMessage  = error_message_s,
    ErrorTime = format_datetime(startTime_t,'dd.MM.yyyy')

The connector name will give me the possibility to classify the failed logic apps and this way I can create a report to show which type of connector we are having issues.

Thanks in advance for your help or another workarround to classify the failed logic apps.

Upvotes: 0

Views: 350

Answers (1)

SwethaKandikonda
SwethaKandikonda

Reputation: 8234

After reproducing from our end, One of the workarounds is that we can fetch the action name of the failed step along with the status using the below query.

AzureDiagnostics
| where ResourceProvider == "MICROSOFT.LOGIC"
| where Category == "WorkflowRuntime"
| where status_s == "Failed"
| extend Status = code_s
| project
    LogicAppName = resource_workflowName_s,
    ResourceRunID = resource_runId_s,
    Operation = OperationName,
    ActionName = coalesce(resource_actionName_s, resource_triggerName_s),
    Status

RESULTS:

enter image description here

Updated Answer

There is no direct way to get the connector's name. One of the workarounds would be using tracked properties to save the connector name and retrieve it through logs. Not a perfect way but this is one of the workarounds that achieves the requirement.

AzureDiagnostics
| where ResourceProvider == "MICROSOFT.LOGIC"
| where OperationName == "Microsoft.Logic/workflows/workflowActionCompleted"
| where status_s == "Failed"
| extend Status = code_s
| project
    LogicAppName = resource_workflowName_s,
    ResourceRunID = resource_runId_s,
    Operation = OperationName,
    ActionName = coalesce(resource_actionName_s, resource_triggerName_s),
    Status,
    ConnectorName = trackedProperties_ConnectorName_s

enter image description here

Below is the flow in my logic app

enter image description here

Failed Run

enter image description here

In logs

enter image description here

Upvotes: 1

Related Questions