Using Azure Application Insights for centralized logging

Tai Bo
3 min readFeb 1

A typical enterprise system usually runs on multiple servers behind a load balancer. The simplest logging option could be logging locally to a location on the server where the app runs. However, this setup makes triaging an issue using the logs difficult. The problem is more prominent if the system consists of multiple applications running on different servers, and the sessions are not sticky. When an error occurs, the developer has to go to the different servers and applications to gather the logs. Even when the developer has gathered all the logs, it may still be challenging to piece together the log events that belong to a same session in a chronological order to troubleshoot the issue.

In the past, I faced this problem with the applications I worked on. When troubleshooting an issue, I had to download the logs from multiple servers. Then, I used grep to search for keywords relating to the error. The process is time consuming, and I often got confused when I could not tell whether a log statement related to the error because of asynchronous events.

Things got much better after I integrated the apps with application insights which has powerful features for monitoring and logging.

In application insight, I can search for telemetry events including logs by entering keyword in the search bar. I can also filter by event types. For example, below screenshot shows all the exceptions that occurred in the last 24 hours.

Application Insights transaction search

I can then drill into a specific exception by clicking on the result which opens the End-to-end transaction details page, as shown in the below screenshot.

Application Insights transaction details

In the far right, I can see details of the exception, including the stack trace. In the middle, I see the different events leading up to the exception and also events following the exception. One interesting thing is app insights is able to detect the different types of the components. In the screenshot, the icon of the server with the cloud depicts my web application that runs on an azure virtual machine, The globe icon represents the web API running on premise with the globe icon. The word “Web…

Tai Bo

Backend developer in .NET core. I enjoy the outdoor, hanging out with good friends, reading and personal development.