Azure Application Insights vs Log Analytics: Which one should you choose?
Tags: azure, azureapplication, loganalytics
Published: 2023-02-22 06:57:41

We often speak to organizations about Azure and one of the common questions is what is the difference between App Insights and Log Analytics.

In this article we will aim to discuss those differences and overlaps.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r83laalhrsocshf1qyw8.png)

If we think about the Azure Monitoring Platform / ecosystem, then Log Analytics and App Insights both play a role within that platform as shown below.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bwe0ci8lod8lpgk1zuy4.png)

Log Analytics plays a role in the storage of Log Data and the analysis of Log Data.

App Insights plays a role in the analysis and insights into log data.

The official line from Microsoft is that in 2018 Log Analytics and [Application Insights](https://www.serverless360.com/compare-application-insights) became a single service to provide powerful end-to-end monitoring for your applications. The 2 resource types are still however separate and have different target use cases and overlaps which we will explore more below. 

The key change that Microsoft has introduced was that App Insights used to be a complete standalone service whereas now you have a workspace-enabled App Insights whereby when you configure an App Insights instance you will also have a Log Analytics workspace which it points to.

Rather than having its own separate log storage, App Insights will store the logs in Log Analytics and App Insights provides views of the log data.

It’s probably easiest to think of Log Analytics as being the raw database and tables for Log data and App Insights is a set of views aimed at providing useful views on your applications’ telemetry data.

**Log Analytics Use Cases**

The most common use cases people will be familiar with for Log Analytics will be a Virtual Machine which will have a logging agent on it which will send telemetry to a Log Analytics workspace.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bu0x6wip964bvfd5x9us.png)

You can also configure other services to send their telemetry logs to a Log Analytics workspace with some examples such as:

- Service Bus
- Frontdoor
- SQL Azure

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u150lo4y1waepuf8n2e6.png)

For many of the Azure resources you can configure the diagnostics settings to send telemetry logs to Log Analytics and this is like infrastructure level logging of how those resources are being used and how they are performing.

**App Insights Use Cases**

With App Insights, you are looking at more application-level use cases. Some of the examples would be things like configuring a Web App, a Function App, or API Management to send application-level telemetry to App Insights.

With the workspace-based App Insights the log data is still stored in a Log Analytics workspace but you are streaming your telemetry to App Insights and viewing it through App Insights.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lpd8tzapvm73ie5ay9rw.png)

**A look under the hood**

With Log Analytics the data sent to the logs is a more raw format and is typically in tables like AzureDiagnostics and AzureMetrics for infrastructure level logs discussed previously, but if your using App Insights you will find the Log Analytics workspace under the hood contains the tables shown below.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9gfytia7pmotwz8e4qp7.png)

These are the tables where App Insights is storing the telemetry data in Log Analytics.

If you look at the “logs” through App Insights (remember we said think of the App Insights as a view on the tables in Log Analytics) you will see the following tables.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xkrra07jt3rll82xptkl.png)

If you write a query of the requests table in App Insights that queries the log table then it is querying the AppRequests table in Log Analytics.

From the perspective of writing a query the below 2 queries are equivalent:

App Insights:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lbytapcgxys44u2c7io7.png)

Log Analytics:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qzbtibcy67r7396om1t2.png)

Notice that the key difference is that the filter on the _resourceId field gets to the app insights resource and the TimeGenerated field in Log Analytics is seen as timestamp in App Insights.

**What additional value does App Insights provide on top of Log Analytics**

Reiterating the point that Log Analytics is the log storage and App Insights is a layer on top aimed at providing friendly views of the Log data to suit application performance management for apps built with App Service, Function Apps or even if your using a Server based IIS app with the telemetry agent, the thing App Insights gives you are added value features which use that log data and present it in ways which help you build and operate awesome apps.

**Transaction Search**

One of the most handy features of App Insights is the transaction search. This allows you to search for requests and dependencies or traces that have been executed by your application.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mx0tx93djfejmp9joyyk.png)

You can then open up the item you’re looking for and it will wind through the distributed trace and show you the call stack of services that have been called. You can see below a request to by API Management which was then forwarded to a Function App.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/piqwemhklckbw3xqawid.png)

**Application Map**

The application map allows me to see the dependencies between my app and resources it may use such as an HTTP endpoint or a SQL database. App Insights will look at the telemetry captured and workout these services and their usage and performance levels.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1a95we3xp3k6aam218du.png)

**Live Metrics**

Live metrics is a great way to see a live stream overview of how your app is working and the requests it is processing.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hoyxnn2ave29wxoub758.png)

**Availability**

Availability allows you to create web tests to ping endpoints in your app and test that they are working and monitor their SLA.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x7gvz69ghjd5qaswicv6.png)

**Failures**

Failures allows you to begin exploring the errors within your app to identify common problems and areas you need to work on.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xvi10hkfhj3dizfmg5ij.png)

**Performance**

Performance shows you the average response times, usage and useful aggregations of the performance data in your app. It’s a great way to explore and monitor your app usage and to troubleshoot performance issues.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s5i6nb7jqlfj0s9v74vq.png)

**Usage**

Usage provides a number of features aimed at helping you explore the user experience and usage of your application.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/akszy0ga5olh3uvi4ny0.png)

You can begin to understand user journeys in your app and how it is used in the real world.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z2luxuiuwzdnejk8umat.png)

There are also lots of deeper dive views and dashboards you can look into.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zo8b314v4a6d86fsed0g.png)

**What do App Insights and Log Analytics mean for Serverless360**

Log Analytics and App Insights are awesome features on Azure and they can really help your team. The challenge with them really falls into the area of roles and responsibilities. In an organization, the Azure experts will be really comfortable with using App Insights and Log Analytics and can do deep dive analysis and learn deep insights about application performance.

The problem is that not everyone in the organization who is a stakeholder in the application or IT operations is an Azure expert and, in most cases, Azure experts are a premium and scarce resource for most organizations.

The value proposition for Serverless360 in this case is to be able to leverage App Insights and Log Analytics data but to present it in a much more consumable format for the IT operations team so they can understand the data in the context of an application they are supporting without needing the steep learning curve to use Azure.

[Serverless360](https://www.serverless360.com/) is all about lowering the total cost of ownership of your solutions by moving support to the left away from your experts and allowing your support teams to be more productive.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d1m85gtvg7zvdtqr6ufk.png)

The example below is a dashboard we created for one of our application teams which shows an overview of how the web services from their application which we expose through API Management are performing.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fzt5fe5rtt869fsqcib8.png)

You can learn more about how Serverless360 democratizes support of Azure solutions around App Insights and Log Analytics via the following articles:

- [Integrating Log Analytics with Serverless360](https://www.serverless360.com/blog/integrating-log-analytics-in-serverless360)
- [Serverless360 and Application Insights](https://www.serverless360.com/blog/application-insights-health-check-with-serverless360)
- [Enable your security manager to see Frontdoor WAF data](https://www.serverless360.com/blog/enable-security-manager-to-azure-web-application-firewall-waf-data)
- [Comparing Log Analytics, App Insights and Serverless360 BAM when using Logic Apps](https://www.youtube.com/watch?v=1N22XLhxsuM)
- [Azure Monitor & Serverless360](https://www.youtube.com/watch?v=n0Je2TrVHFs)

**Conclusion**

Hopefully, this article clarifies your understanding of the relationship between Log Analytics and App Insights. Log Analytics is the log storage and query resource which can be used by both infrastructure-level and application-level solutions. It is about storage and query of log data.

Application Insights is a layer on top of Log Analytics aimed at application-level telemetry and uses the log data stored in Log Analytics to provide an additional bunch of features that make App Insights an Application Performance Management tool.

Both are highly likely to be part of your architecture and provide great features to help you build better apps and operate well used infrastructure.