I have different application insights within different directories and then different subscriptions.
WebAPI1: ApplInsights1, Subscription1, Directory1
WebAPI2:ApplInsights2, Subscription2, Directory2
I want to get the percentage of HTTP requests of endpoints for both APIs. sp for example If there are 100 requests for API1 and 100 for API2 and there is one endpoint which is called 10 times. then the percentage will be 5.
I am able to get the individual API, But I am not able to get the combined result in one single query window. Please help. I am very new to KQL.
Below is the query for WebAPI1.
requests
| where cloud_RoleName == "WebAPI1"
| summarize count() by operation_Name
| extend percentage = 100.0 * count_ / toscalar(requests | where cloud_RoleName == "WebAPI1"| count)
| project operation_Name, percentage
| order by percentage desc
Note: I am new to KQL so please ignore silly mistakes in my question.
Edit: I have tried what has been told by Rithwik, But I can't see an option to select subscriptions. It shows only one subscription.
How to query from different app insights in Azure?
Yes, you can query, Firstly open Monitor in Azure Portal Then set scope(according to your requirements) like below:
For requests logs of App services logs and Function app logs you can use below :
AppRequests
|where AppRoleName contains "x" or AppRoleName contains "y"
This is one of way of doing, Other way is to export logs to a Log analytics workspace and then also you can query the results from that workspace.