How to Check Logs in Application Insights in Azure Portal

Getting a bit confused with application insights or looking for some clarification? Here we will cover about Azure and its Application Insights logs.

What is Azure?

The second-largest and fastest-expanding cloud-computing platform is Microsoft Azure. It is an online portal that gives you access to and control over Microsoft’s resources and cloud services. Depending on your needs, these tools and services also contain the ability to store and process your data. You only need a stable internet connection to access the Azure portal. It is free to start using and uses a pay-per-use business model, so you only pay for the services you use.

It’s interesting to note that Azure services are used by 80% of Fortune 500 organizations for their cloud computing requirements.

Java, Node Js, and C# are just a few to name programming languages supported by Azure.

What is Application Insights?

Azure Monitor has an extension called Application Insights. It offers application monitoring features, usually called “APM,” informally. The primary purpose of APM tools is to monitor applications throughout their whole lifecycle, from development to testing and production.

In identifying the root cause of an incident, they proactively comprehend an application’s performance and reactively examine the execution data of the application.

Application Insights can be used to gather and store application trace logging data in addition to compiling metrics and application telemetry data, which characterize the actions and status of the application.

The logging trail is combined with additional telemetry to provide a comprehensive picture of the action. Existing apps can add trace recording by simply specifying a location for the logs; the logging framework rarely must be altered.

The following aspects can be monitored using Application Insights.

Application performance: Data, such as response rates, exception rates, failure rates, and page load durations, can be explicitly collected by Application Insights. In addition, the Azure platform provides host diagnostics data, performance counters (CPU, memory, and network usage) from Windows/Linux servers, containerized workloads that help identify application bottlenecks, and information on the CPU, memory, and network consumption of Windows/Linux servers. Application Insights also gives deeper analysis through stack traces and assists in capturing issues involving both the server and the browser.

Application availability: You can set up Application Insights to run ping tests or web requests to verify the accessibility of your applications. Using the SDK, any existing custom applications you may have for tracking availability can be combined with Application Insights. In this manner, the reaction time and availability of apps.

Application usage: The detailed analytics provided by Application Insights assist you in analyzing user interaction through data such as the most popular sites and peak access hours. Another indicator that is accessible to you to help you better understand application usage is user and session count data. Additionally, identifying underlying resource limitations will be aided by the correlation of usage statistics with application performance measurements.

Custom monitoring: Customers can create custom codes and events to track application events using Application Insights and the built-in metrics. You can monitor, for instance, the acceptance of a new product feature or the trends surrounding a particular product.

Let us now see how to check logs in Application Insights.

Checking logs in Application Insights

Step 1: Create an instrumentation key

Enter “Application Insights” into the search bar on the Azure Portal.

To create a new Application Insight, click the + New icon button.

Fill up the information below:

Resource Group: Use the current resource group if you already have one, or create a new one with the name NetworkWatcherRG.

Name Enter LogsAppInsights as the name.

Region: Choose the preferred area.

Find the resource group where LogsAppInsights was created, click on it, and then choose the resource for app insights. Next, copy the Instrumentation Key from the top of the help.

Step 2: Configure the App Insights 

For instance, to use an ASP.NET Core 5.0 application, we must have Visual Studio 2019 and the.Net 5.0 SDK installed on our computer. In addition, the newly created Instrumentation Key needs to be configured to make Applications Insights work on our Project.

Once the ASP.NET Core application has been created in Visual Studio.

Add the Application Insights service to Startup.cs File and install the necessary NuGet package.

Add the Instrumentation key, which serves as the resource’s identifier for application insights. The configuration provider will be used to retrieve the key if we leave the instrumentation key blank or pass it inside the service. The key in the appsettings.json file has to be defined.

We have to set up the Application Insights in our application using the Instrumentation mentioned above.

When you select LogsAppInsights from the menu bar, the Logs option can be found in the Monitoring area. Selecting this option will take you to NewQuery, where you can view your options.

ClearInsights Centralized Application
Logging & Monitoring

Fully integrated application logging and monitoring – enabling software teams and businesses to build fast while having clear insight into their products and applications.

Add ClearInsights Logging with just a few lines of code and automically push new found errors directly to your teams backlog.

 builder.Logging.AddClearInsightsLogger(configuration =>
     configuration.ApiKey = "{ApiKey}";
     configuration.Secret = "{Environment Client Secret}";
     configuration.ApplicationName = "{Application Name}";
ClearInsights community plan is always free for small projects

Logs in Application Insights: View Them

  1. In your resource group go to Application Insights
application insights
  • You will find under Monitoring option Logs. To get log traces click on the button traces.
  • Now you will need to select Time Range and then click on Run
  • You can search for specific log traces by writing your log queries in  KQL (Kusto Query Language)
  • You can even filter out the results of the query on any column
  • You can also view the query output in chart formats

There are several options to view the various logs under Application insights on the right side of the screen.

Double-click the traces (an object in which our log messages are recorded) option to display the Query window. Finally, click the Run button to view the output, as shown in the image below.

The warning, error, and critical alerts are displayed here, as described earlier, and we can also enter queries. Hope you would have found this article helpful. Enjoy your working with Azure.

Leave a Reply