access_time 2 years ago languageEnglish
more_horiz

Configure Azure Blob Storage as Application Log Storage

visibility 2,239 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 ...
info Last modified by Administrator 6 months ago
thumb_up 0

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

comment Comments
2 years ago link more_horiz
Raymond Raymond
web_assetArticles 586
imageDiagrams 41
forumThreads 9
commentComments 220
loyaltyKontext Points 6330
account_circleProfile
#380 Re: Configure Azure Blob Storage as Application Log Storage

Hi Felix,

Unfortunately, I don't think you can write logs to just one file as it is hard-coded:

var blobName = $"{_appName}/{key.Year}/{key.Month:00}/{key.Day:00}/{key.Hour:00}/{_fileName}";

You have to implement your own customized logger to do that. Azure Blob Storage has .NET APIs you can use to invoke in your ASP.NET core applications to write into blob storage directly. 

For example, the following article uses those APIs to write uploaded images into Azure Blob Storage and you can easily change it to write text files. 
format_quote

person Felix access_time 2 years ago
Re: Configure Azure Blob Storage as Application Log Storage

Hi, great article! 

Is it possible to change the folder structure of the logs from 

"Year (2020) > Month (12) > Day (22) > Hour (05) > Application log file."
To just one simple Logfile? Like ./logs/applicationlogfile.log

I tried several things in .ConfigureLogging()

But I'm not sure if the Azure App Service is just overwriting the settings or not. It's kind of time consuming to find a solution because it always requires a web release + appservice restart to test it... After several hours I'm kind of desperated now :) 

If they would it must work with disabling logging on the Azure portal settings and then define the destination of the logfile manually in .ConfigureLogging().

2 years ago link more_horiz
F
Felix
web_assetArticles 0
imageDiagrams 0
forumThreads 0
commentComments 1
loyaltyKontext Points 1
#379 Re: Configure Azure Blob Storage as Application Log Storage

Hi, great article! 

Is it possible to change the folder structure of the logs from 

"Year (2020) > Month (12) > Day (22) > Hour (05) > Application log file."
To just one simple Logfile? Like ./logs/applicationlogfile.log

I tried several things in .ConfigureLogging()

But I'm not sure if the Azure App Service is just overwriting the settings or not. It's kind of time consuming to find a solution because it always requires a web release + appservice restart to test it... After several hours I'm kind of desperated now :) 

If they would it must work with disabling logging on the Azure portal settings and then define the destination of the logfile manually in .ConfigureLogging().

timeline Stats
Page index 4.07