Configure Azure Blob Storage as Application Log Storage

visibility 3,203 comment 2 event 2020-12-22 access_time 12 months ago language English

Azure App Service is a server-less product that can be used to host websites. For ASP.NET core websites, App Service Log feature allows users to configure logging for the web application. This article will show you how to configure Azure Blog Storage container as logging storage for ASP.NET Core web applications.

Config App Service Log

Follow these steps to collect logs and save them to Azure blob storage.

  1. Go to Microsoft Azure portal.
  2. Navigate to your ASP.NET Core App Service instance. 
  3. Click App Service logs in Monitoring section: 
  4. Toggle setting Application Logging (Blob) on. As part of this, an extension named ASP.NET Core Logging Integration will be installed. 

  5. Configure logging level. There are four levels that can be configured:
    • Error
    • Warning
    • Information
    • Verbose
  6. Choose Azure blog storage container.

  7. Click Save button to save changes. 

The following screenshot shows the settings for Kontext platform:

The logs are stored for 180 days in kontexttech storage account's site-logs container. 


View logs in blob storage

Navigate to the blob storage container, you will find the logs are organized in the following folder structure:

Year (2020) > Month (12) > Day (22) > Hour (05) > Application log file.

The following is one example log file generated on Kontext:


About ASP.NET Core Logging Integration

In the above steps, we utilized the features of Azure App Service to enable logging to Azure blog storage.

You can also directly enable it as part of your ASP.NET Core web application build.

To do this follow these steps:

using Microsoft.Extensions.Logging;

public static IHostBuilder CreateHostBuilder(string[] args) =>
        .ConfigureLogging(builder => builder.AddAzureWebAppDiagnostics())
        .ConfigureWebHostDefaults(webBuilder =>
info Last modified by Administrator 12 months ago copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts