Configure Azure Blob Storage as Application Log Storage

access_time 25 days ago visibility17 comment 2

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) =>
    Host.CreateDefaultBuilder(args)
        .ConfigureLogging(builder => builder.AddAzureWebAppDiagnostics())
        .ConfigureWebHostDefaults(webBuilder =>
        {
            webBuilder.UseStartup<Startup>();
        });
info Last modified by Raymond 25 days 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

Follow Kontext

Get our latest updates on LinkedIn or Twitter.

Want to publish your article on Kontext?

Learn more

More from Kontext

visibility 1181
thumb_up 0
access_time 4 years ago

Other related issues are found during my migration. https://stackoverflow.com/questions/46118930/unable-to-change-asp-identity-table-names-asp-net-core-2 I faced the same issue as the above post. To fix it, I need to derive my database context with all the parameters specified: public ...

visibility 481
thumb_up 0
access_time 7 years ago

Creating virtual machine in windows azure is quite straightforward. After logged into the management portal ( www.azure.com ), you can create one VM within 4 steps. In the tab 'Virtual Machines', click the link button 'CREATE A VIRTUAL MACHINE' to start. Click 'From Gallery' in the popup ...

Load Microsoft 365 SharePoint List Data in Python
visibility 809
thumb_up 0
access_time 5 months ago

A Microsoft SharePoint list is a collection of data can be shared with team members or people who you give access to. It is commonly used to capture commonly maintained master data from manual inputs.  This article summarizes steps to create a SharePoint list and then load the data in the list ...