question

NSou-6994 avatar image
0 Votes"
NSou-6994 asked SwathiDhanwada-MSFT answered

For querying App Insights traces, should we query the Application Insights REST API or the Log Analytics Rest API?

Both the Application Insights REST API and the Log Analytics REST API seem to support similar queries. I thought that App Insights logged to a Log Analytics Workspace, but now I feel confused... what is the relationship between these and which should we be querying to retrieve trace data logged by our application? Thanks.

Update: I now see an Azure Data Explorer SDK also. Which one of these 3 should I use??


azure-monitor
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@NSou-6994 Thanks for reaching out. Seems SO Community member John Gardner has responded to your question. Kindly check if that helps and revert if you have further questions.


Reference Link : https://stackoverflow.com/questions/66782056/which-api-should-be-used-for-querying-application-insights-trace-logs

1 Vote 1 ·

1 Answer

SwathiDhanwada-MSFT avatar image
0 Votes"
SwathiDhanwada-MSFT answered

For the benefit of the community, re-posting the answer posted by community member.

The difference between #1 and #2 is mostly historical and converging.

  • Application Insights existed as a product before log analytics, and were based on different underlying database technologies

  • Both Application Insights and Log Analytics converged to use the same underlying database, based on ADX (Azure Data Explorer), and the same exact REST API service to query either. So while your #1 and #2 links are different, they point to effectively the same service backend by the same team, but the pathing/semantics are subtly different where the service looks depending on the inbound request.

  • both AI and LA introduce the concept of multi-tenancy and a specific set of tables/schema on top of their azure resources. They effectively hide the entire database from you, and make it look like one giant database.

  • there is now the possibility (suggested) to even have your Application Insights data placed in a Log Analytics Workspace https://docs.microsoft.com/en-us/azure/azure-monitor/app/create-workspace-resource, this lets you put the data for multiple AI applications/components into the SAME log analytics workspace, to simplify query across different apps, etc

  • Think of ADX as any other kind of database offering. If you create an ADX cluster instance, you have to create database, manage schema, manage users, etc. AI and LA do all that for you. So in your question above, the third link to ADX SDK would be used to talk to an ADX cluster/database directly. I don't believe you can use it to directly talk to any AI/LA resources, but there are ways to enable an ADX cluster to query AI/LA data: https://docs.microsoft.com/en-us/azure/data-explorer/query-monitor-data and ways to have a LA/AI query also join with an ADX cluster using the adx keyword in your query: https://docs.microsoft.com/en-us/azure/azure-monitor/logs/azure-monitor-data-explorer-proxy

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.