Azure Monitor offers many different tools to help you monitor the performance of your application and systems, allowing you to quickly identify issues that may otherwise impact the availability of your Azure applications. In this article, we’ll discuss the logging and monitoring capabilities available within Azure Monitor, including metrics and logs. Then we’ll review the capabilities that help you monitor application health, including alerts and diagnostics. Finally, we’ll cover how to monitor your environment with alerts, diagnostics and logs from multiple Azure resource providers in one pane of glass.
Understanding monitoring in the cloud
It’s a huge topic, one that spans an entire stack of technologies, from development tooling to production processes. That said, I want to focus on one piece of that puzzle in particular—the monitoring services provided by Azure itself. There are a lot of moving parts (you can see some in our Azure Architecture Center), but I want to zoom in on two pieces that are both easy to use and power Microsoft services you probably use every day. The first is Azure Application Insights (AI). AI gets mentioned often because it’s integrated with a number of popular development tools—Visual Studio, Xamarin Studio/MonoDevelop, GitHub, etc.—but there are also some features you might not know about.
Setting up log collection
Log collection helps you identify issues, set up diagnostics, and make improvements to your infrastructure’s performance. By turning on log collection, you give yourself a detailed history of application behavior. This helps track down bugs when they occur in production or otherwise provide important information when issues do arise. Although it isn’t included by default in Windows Azure Web Sites, setup is simple to enable. Learn how to turn on logging here . After installation, collecting logs will be easy with one-click integration with popular storage options such as blob storage, SQL Database, HDInsight , and more. Best of all? All data collected through log management comes at no additional cost!
Fully explore different ways to monitor your cloud applications: Depending on what monitoring options are available in your environment, you may have a number of tools at your disposal — some built into tools like Windows Azure Web Sites (WAWS) while others that require additional configuration like those mentioned above (e.g., collection from IIS logs). If you’re just getting started, familiarize yourself with everything available from within WAWS first because doing so will help ensure nothing gets overlooked during initial setup.
Analysing and interpreting logs
The first thing to do is to ensure that you are logging as much information as possible. The more detail your log files contain, the easier it will be to determine where a problem may have occurred. As a basic rule of thumb, you should be logging everything from your application (such as error codes) and any data changes that occur in relation to external resources such as a database. But what are you logging? In Azure context there are three main types of logs: operational logs , diagnostic logs and audit logs . Operational logs provide valuable information about how Azure itself is operating, while diagnostic logs capture rich details about problems within your applications. Audit logs record events such as user access attempts, with additional configuration available depending on which resource or service you’re using. These three core types cover a wide range of situations, but there’s always room for improvement—and even customizations when required.
Debugging an issue with logs
Debugging cloud issues can be a challenge—and sometimes, figuring out where an issue is coming from requires you to search through your logs. Azure offers a robust logging system that tracks everything from usage to application errors in one centralized place. It’s easy to get lost in it, though, and you may need some help figuring out what your problem might be. Here are some general tips to help you get started searching through Azure logs. Microsoft recommends most people start with Application Insights when looking for answers about their app; if your app isn’t using Application Insights, check our list of FAQs and log-related blogs. When looking at logs on your machine you will want to view them using one of these tools (which also works on Linux) or via Visual Studio or other Microsoft tooling as detailed here. That said, if there is something very specific that only appears in those two places then start by viewing those log files yourself so you can investigate them more easily than trying to reconstruct how someone else saw them. What are common things that happen with App Service?
Performing root cause analysis (RCA)
Once you’ve tracked down an issue, conducting a root cause analysis can reveal why it happened, who else is affected (so you can escalate to your IT support if needed), and more. Depending on your problem’s severity, RCA may not be necessary. But keep in mind that as issues become more complex and involve more people, they may need additional analysis. The goal of RCA is to reduce downtime (or avoid it altogether) by identifying what caused an issue so that you can prevent a similar situation from happening again. RCA involves asking these five questions: What happened? Why did it happen? Who was involved? What can we do about it? Are there any other effects of these issues or things we should be aware of?
Once you have your log data in Azure, you can create a dashboard to monitor it. The analytics in Azure are divided into six service areas—App Service, BizTalk Services, Cosmos DB, Machine Learning Studio, SQL Database, and Web Apps—which each have their own dashboard. All of these dashboards are editable; that is to say that you can customize them to show only information you want. For example, if you want all activity from a specific application or website on your dashboard, just add it from there. If there’s something more comprehensive that your business requires, like having every app available on one page for monitoring purposes (and who wouldn’t?), then simply add all of those specific applications or just select relevant ones.