3

我正在使用以下查询从使用 AppInsights 以 400 失败的请求中获取 operationId 值:

requests 
| project timestamp, id, operation_Name, success, resultCode, duration, operation_Id, cloud_RoleName, invocationId=customDimensions['InvocationId'] 
| where cloud_RoleName =~ 'xxxx' and operation_Name == 'createCase' and resultCode == 400 
| order by timestamp desc

我在以下查询中使用这些 operationId 值来获取所发生事件的日志:

traces
| union exceptions
| where operation_Id == '35edbc7c13f7ac4c85fa0b8071a12b72'
| order by timestamp asc

在此处输入图像描述

有了这个,我得到了我想要的信息,但我需要多次编写和执行查询,所以我试图在两个查询之间进行连接但没有成功,因为我不是查询 AppInsights 的专家,我不确定关于如何加入工会,你能帮我吗?

4

1 回答 1

4

请尝试以下查询:

requests 
| project timestamp, id, operation_Name, success, resultCode, duration, operation_Id, cloud_RoleName, invocationId=customDimensions['InvocationId'] 
| where cloud_RoleName =~ 'xxxx' and operation_Name == 'createCase' and resultCode == 400 
| join (
    traces
    | union exceptions
) on operation_Id
| project-away operation_Id1
| order by timestamp asc

有关运算符的更多详细信息join- https://docs.microsoft.com/en-us/azure/kusto/query/joinoperator

于 2019-10-15T17:25:24.077 回答