我有一个apim实例,配置为登录到应用程序洞察。
我运行以下kusto查询以提取有用的信息:
requests
| extend requestBody = customDimensions["Request-Body"]
| extend requestMethod = customDimensions["HTTP Method"]
| extend ApiName = customDimensions["API Name"]
| where ApiName == "client"
| project timestamp, ApiName, url, requestBody, requestMethod
| sort by timestamp desc
";url";它返回的是apim实例的入站url。有人知道如何更新这一点,以收回apim转发请求的后端url吗?
如果您正在将后端应用程序的日志写入application Insights的同一实例,您可以简单地将查询结果与;请求";表,使用APIM请求的operation_Id和后端请求的operations_ParentId。
您还可以将APIM请求与依赖关系表连接起来。这也应该给你后端请求:
dependencies
| where timestamp > ago(1h)
| join (requests | where timestamp > ago(1h))
on operation_Id
之后,您可以提取您感兴趣的字段。
编辑:要获取仅包含APIM记录的数据的后端URL字段,而不包含Application Insights的后端日志,您可以使用依赖关系表的"数据"字段来连接请求和依赖关系,如下所示:
dependencies
| where timestamp > ago(1h)
| join (requests | where timestamp > ago(1h))
on operation_Id
| project backendUrl = data