Azure App Service - Configure Web Server Logs

In my previous articles listed below, we learned how to create Azure App Service web app.

  1. Azure App Service: Create Web App from Visual Studio
  2. Azure App Service - Configure Existing Application from Visual Studio

Prerequisites

  1. Azure Account
  2. FileZilla

Azure allows us to enable the Web Server diagnostic services for debugging and troubleshooting for all the App Services. Below are the different types of services that Azure App Service provides us.

  1. Detailed Error Logs: These error logs provide us information about all the HTTP errors that are generated.
  2. Failed Request Tracing: These logs helps us understand the reasons for all the failed requests.
  3. Web Server Logging: These logs provide information about all the events that occur on the server like number of requests, IP Address of the user who made the requests etc.

Let’s see how to enable Web Server Logs for Azure App Service in this article.

Navigate to the App Service to which you would like to enable the Web Server Logs and go to “All Settings” and click on “Diagnostic Log” as shown below.

Diagnostic Log

Now, in the “Logs” blade, select “File System” for the “Web server logging” field. By default, the “Web server logging” is “Off”,
Web server logging

Now, click on “Save” button to save the changes.

After a few seconds the “Web server logging” is enabled for the App Service.

Below is the screen capture of the root folder of the App Service taken from FileZilla.

folder

Now, let’s access the App Service by clicking on “Browse” button and see what happens.

Browse

The site will be displayed as shown below.

output

Now, Let’s go to FileZilla refresh as shown below.

refresh

As shown below, a folder named “http” is created the root folder.

http

The “http” folder contains another folder named “RawFiles” which is the place where all the Logs are created as shown below.

RawFiles

Below is the glimpse of .log file.

glimpse

  • 1st Line – Browser name.
  • 2nd Line – Column headings of the request details.
  • 3rd Line – Values – These are all the values of the request details.

It’s not easy to view and understand the Logs in a text file. It would be really nice to have a tool that displays the data in a readable format. Azure provides a lot of Site Extensions that we could install to our App Service. Once such extension is “Log Browser”. Please have a look at the below article on how to install the extension to your App Service and view the Log data.

Hope you enjoyed the article. Your feedback is highly appreciated.