How to Retrieve HTTP Logs from an Azure App Service

There are times when you need to see the raw requests being handled by your Azure App Service. While there are many logging and diagnostic tools at your disposal, I personnally like to get right down to the raw HTTP requests to really see what's really going on.

Azure has some very neat tools for seeing 'live'(ish) log streams from within the Portal, but sometimes you may wish to look through some historical logs to ascertain why you had, for example, the infamous 500 Internal Server Error. That's exactly what I had to do for a project that I was working on to pin-down why a App Service was failing.

This article provides a step by step description of how to download the raw HTTP logs from a App Service in Azure via FTP for local analysis using your tool of choice.

FTP

The first piece of information you will need is the FTP or FTPS address to connect to. This is available from the Azure Portal by navigating to the respective App Service, then selecting App Service Logs

On the App Service Log blade, scroll down until you see Download logs

Copy the required information from the respective fields.

Next you will need the credentials to use when establishing the FTP or FTPS connection. To find this information, under the Deployment settings for the respective App Service, locate and click Deployment Center

On the Deployment Center blade, locate and click the Deployment Credentials menu.

From this blade (if you have sufficient permissions) you can view the required Username and Password.

You now have all the information to FTP to your App Service. Using your FTP client of choice (FileZilla is my tool of choice), establish a connection to your App Service. You should see a directory listing similar to the one displayed below:

It's now just a matter of navigating the folder structure until you find the HTTP logs, which can be found in the LogFiles folder:

In the RawLogs folder in the httpfolder:

Once in that folder you can see the raw http log files (the number of which will be restricted by the configured retention policy).

Once you have located the log file or files you wish to examine, you can download and use your tool of choice to analyse them. My personal tools of choice are NotePad++, VSCode and a cool little utility called Log Parser Studio that provides a SQL like querying interface for analysing your log files!