1

嗨,我正在尝试使用逻辑应用程序和日志分析来设置某种基本日志记录。当通过 runID 搜索失败的运行时,我会获取该运行的每个单个操作、跳过、失败成功等等的数据。

有没有办法编写某种查询以将所有操作分组到一个有用的记录中,该记录包含每个操作的必要数据以及自定义跟踪属性(我在工作流中使用撰写进行跟踪)?

以前有人做过类似的事情吗?

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

例如,我现在正在做的是通过执行以下操作来搜索特定的工作流程:

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"
4

0 回答 0