-
Notifications
You must be signed in to change notification settings - Fork 2
/
ApiManagementFailedRequestDetails.txt
28 lines (27 loc) · 1.79 KB
/
ApiManagementFailedRequestDetails.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
For connected Log Analytics Workspaces:
------------------------------------------
AzureDiagnostics
| where ResourceProvider =~ "Microsoft.ApiManagement"
| where isRequestSuccess_b == false
| project TimeGenerated, ResourceName=tolower(Resource), ApiName=apiId_s, OperationName=operationId_s, ResponseCode=responseCode_d, ErrorType=lastError_source_s, ErrorReason=lastError_reason_s, ErrorMessage=lastError_message_s
For connected Application Insights:
------------------------------------------
requests
| where sdkVersion startswith "apim:" and success == false
| project timestamp, operation_Id = tostring(operation_Id), requestId=customDimensions["Request Id"], requestName=name, url, httpCode=resultCode, httpMethod=customDimensions["HTTP Method"], duration, userId=user_AuthenticatedId, apiName=customDimensions["API Name"], apiRevision=customDimensions["API Revision"], apiOperation=customDimensions["Operation Name"], apiProduct=customDimensions["Product Name"], apiSubscription=customDimensions["Subscription Name"]
| order by timestamp desc
| lookup kind=leftouter (
requests
| where operation_Id <> operation_ParentId
| project operation_Id=tostring(split(trim_start(@"\|", operation_ParentId), ".")[0]), inner_operation_Id=operation_Id) on operation_Id
| lookup kind=leftouter (
exceptions
| where customDimensions['Category'] == "Host.Results"
| project exceptionType=type, severityLevel, resourceName = cloud_RoleName, operation_Id, operationName = operation_Name, exceptions = array_reverse(['details'])
| mv-apply exceptions on
(
project message = exceptions["message"]
| summarize messages = make_list(message, 5)
| project exceptionMessages = strcat_array(messages, " | ")
)) on $left.inner_operation_Id == $right.operation_Id
| project-away inner_operation_Id, operation_Id