如果运行失败,则在日志分析中使用Group Logic应用操作/连接器

时间:2018-03-10 16:39:16

标签: azure-log-analytics azure-monitoring

您好我正在尝试使用逻辑应用程序和日志分析来设置som类型的基本日志记录。当通过runID搜索失败的运行时,我得到该运行的每个singel操作,跳过,失败成功等的数据。

有没有办法编写某种类型的查询,将所有操作分组到一个包含每个操作所需数据的有用记录,还包括自定义跟踪属性(我在工作流程中使用撰写跟踪)?

之前有人做过类似的事吗?

我想稍后使用此记录,以便能够在天蓝色监控中设置警报。

我现在正在做的事情是通过这样做来搜索特定的工作流程:

AzureDiagnostics
| where resource_workflowName_s =="[Logic App Name]"
| where resource_runId_s == "[RUN_ID]"

我得到了所有行动的结果,跳过了成功,失败了,什么不行。

我只想要1条记录,其中包含失败运行的必要信息。

更新:

所以我在逻辑应用程序所连接的OMS上查看它,我几乎设法通过OMS生成的默认查询得到我想要的,我缺少的是每次运行的跟踪值,在失败的运行

AzureDiagnostics
| where Category == "WorkflowRuntime"
| where OperationName == "Microsoft.Logic/workflows/workflowRunCompleted"
| join kind= rightouter
(
AzureDiagnostics
| where Category == "WorkflowRuntime"
| where OperationName == "Microsoft.Logic/workflows/workflowRunStarted"
| join kind= inner
(
    AzureDiagnostics
    | where Category == "WorkflowRuntime"
    | where OperationName == "Microsoft.Logic/workflows/workflowTriggerCompleted"
    | project TriggerName = Resource, resource_runId_s
)
on resource_runId_s
| project WorkflowStartStatus=status_s, 
WorkflowNameFromInnerQuery=resource_workflowName_s, 
WorkflowIdFromInnerQuery=workflowId_s, 
ResourceGroupFromInnerQuery=resource_resourceGroupName_s, 
RunIdFromInnerQuery = resource_runId_s, OriginRunIdFromInnerQuery = 
resource_originRunId_s, TrackingIdFromInnerQuery = 
correlation_clientTrackingId_s, StartTimeFromInnerQuery = startTime_t, 
resource_runId_s, TriggerName
)
on resource_runId_s
| extend WorkflowStatus=iff(isnotempty(status_s), status_s, 
WorkflowStartStatus)
| extend WorkflowName=iff(isnotempty(resource_workflowName_s), 
resource_workflowName_s, WorkflowNameFromInnerQuery)
| extend WorkflowId=iff(isnotempty(workflowId_s), workflowId_s, 
WorkflowIdFromInnerQuery)
| extend ResourceGroup=iff(isnotempty(resource_resourceGroupName_s), 
resource_resourceGroupName_s, ResourceGroupFromInnerQuery)
| extend RunId=iff(isnotempty(resource_runId_s), resource_runId_s, 
RunIdFromInnerQuery)
| extend OriginRunId=iff(isnotempty(resource_originRunId_s), 
resource_originRunId_s, OriginRunIdFromInnerQuery)
| extend TrackingId=iff(isnotempty(correlation_clientTrackingId_s), 
correlation_clientTrackingId_s, TrackingIdFromInnerQuery)
| extend StartTime=iff(isnotempty(startTime_t), startTime_t, 
StartTimeFromInnerQuery)
| extend EndTime=endTime_t
| extend Duration=iff(isnotempty(EndTime), todouble(EndTime - StartTime) / 
10000000, double(null))
| where WorkflowId == "/SUBSCRIPTIONS/B405FEEE-D8DA-484B-8285-4399B07EFFCA/RESOURCEGROUPS/INTEGRATION_RG_TEST/PROVIDERS/MICROSOFT.LOGIC/WORKF
LOWS/RABE_REST_CARUS_V2"
| project WorkflowName, WorkflowId, WorkflowStatus, Duration, ResourceGroup, 
TrackingId, RunId, StartTime, EndTime, TriggerName
| top 10001 by RunId asc`enter code here`
| where WorkflowStatus == "Failed"

0 个答案:

没有答案