>, Azure Cloud>Diagnostic logs, live stream, process explorer and KUDU: Part 4

Diagnostic logs, live stream, process explorer and KUDU: Part 4

By | 2018-02-25T11:00:12+00:00 January 30th, 2018|Categories: Azure App Service, Azure Cloud|Tags: , , , |0 Comments

I am putting together a series for people who are excited to bring Azure into their software development life cycle and use Azure cloud’s extensive services to their full potential.

In this series, I will cover as below:

  1. Getting Started with Azure Development, Create App Service Plan and Publish MVC project using Visual Studio
  2. Deployment Slots and Slot Swap on Azure App Service using Visual Studio and Azure SDK
  3. Remote debugging App Service using visual Studio, monitoring and configuring alerts
  4. Diagnostic logs, live stream, process explorer and KUDU
  5. How to use Azure SQL Database in Dot.net Applications
  6. How to use Azure DocumentDB or Azure Cosmos DB in our Dot.net Applications
  7. How to use Visual Studio Team Service to do continuous Integration and continuous delivery
  8. Azure storage data services types and how to store files in azure storage account 1/2
  9. Azure storage data services types and how to store files in azure storage account 2/2
  10. How to use Azure Functions and trigger on new image/blob creation in Azure Storage using BlobTrigger 1/2
  11. How to use Azure Functions and trigger on new image/blob creation in Azure Storage using BlobTrigger 2/2

If you do not know where to start, please check my blog post, which covers detail about getting subscription and setting up. In this series, we assume that you already have active Azure subscription and Visual Studio 2013 or later installed on your system.

  1. Diagnostic logs, live stream, process explorer and KUDU

Logs are essential part of every developer’s life; it gives us the detailed information about what is going on in our system in specific date and time. Azure App Service enable us to log on many levels i.e. IIS level, Application level etc. to satisfy our needs. Let us look into few important ones to get started.

Go to Azure Portal and then App Service | Monitoring | Diagnostic logs, by default Diagnostic logs are disabled as you can see in the below picture.

Figure 1 Diagnostics logs disabled

To view application logs you need to turn on Application logging, we have two options here one is Filesystem and other is Blob, filesystem logging is used to stream logs live and have disadvantage that it will turn off after 12 hours, but in blob case, it will keep on going for ever unless you reach the Storage account limit. This is because the filesystem logs may fill up the App Service Plan storage but in blob logging, it can keep on going as we usually have a larger blob storage in azure.

When we enable the Filesystem logging, options are self-explanatory. If you want to log everything, you should choose verbose option.

Figure 2 Enable Application logging (filesystem) verbose

Web server logging will give us IIS Logs. Detailed error messages is to override settings for custom error and failed request tracing enables IIS failed request feature, this feature could be helpful in tracing the issues which may not appear in application logs as the request may not be reaching to your applications and in this case failed request tracing is the way to go.

Figure 3 Diagnostic Logging types explained

Now you would be wondering we enabled all these logs where could we find these logs, you can connect to server using ftp and get the logs or use KUDU to get these logs, which I will show later in this post. Let us move to live stream, which is a handy way of viewing logs on Azure portal.

Figure 4 ftp logs download

Go to Diagnostics | Live Stream, you would see now the information related to the application in Application logs tab and information about IIS is in web server logs if you have enabled both first in diagnostics.

Figure 5 Application Logs in Live Stream

Remember that even though name suggest that it is Live Stream but it may take few minutes for logs to show up, so do not worry if you do not get logs right away.

If you are interested in, which processes are running in your App Service, then you look them in Monitory | Process Explorer. This will provide you basic information about CPU and memory, but you can get more information about running processes in the tool called KUDU.

I have mentioned many times the tool KUDU, this is time to look what is KUDU and how to use it, Go to Azure Portal and then App Service | Development Tools | Advanced Tools | GO, this will open [your site].scm.azurewebsites.net and as you can see; it have many tabs including Process Explorer

Figure 6 KUDU Advanced Tools in App Service Plan

Now as you can see, this tool provides you robust information and you can even drill down and check the properties or start profiling.

Figure 7 Process Explorer in KUDU

Figure 8 KUDU process explorer properties

Kudu have many useful tools, one is Diagnostic dump, and this option will get all the logs and give a single zip file for you. You can see it have log stream and web jobs, web hooks and even deployment script for the App Service with current configuration in case you need to replicate it on another data center.

Figure 9 Kudu Diagnostic dump and log stream

There is another way, we could get the logs files using KUDU, let us do that now. Choose Debug console and then click on CMD. You can use fully functional CMD here; try some commands. Now click on LogFiles

Figure 10 Debug console CMD

You will find all the logs here and can even download them to your system as well. If you want to explore files which you deployed click on … and go to site | wwwroot and all the files will be listed there and if you change any file then in case; your application is running on multiple servers then this change will be replicated automatically and you don’t need to worry about changing it in every server.

Figure 11 Log files in KUDU

Azure also have Application Insights, which is free to start but will charge you if telemetric data is exceeding the free limit, it give you tremendous amount of information about performance and health of your resources,

I have put together a post regarding basic installation on WordPress but it could be used as starting point

Figure 12 Application Insights Overview

For more information:

https://docs.microsoft.com/en-us/azure/application-insights/app-insights-overview

Application Insights even offer you SDK to carve up your own solutions. Remember that in order to enable Application Insight to get the data about your application you may need to install Application Insight nugget package in your application.

Coming up next How to use Azure DocumentDB or Azure Cosmos DB in our Dot.net Applications

 

  • 4
    Shares

About the Author:

I am an azure solutions architect along with SharePoint Developer/Admin having years of Microsoft products experience essentially for development , I love to help others and make a change in the world and this blog is the one way I use to achieve this goal.

Leave A Comment

Skip to toolbar