简体   繁体   English

Azure Blob 存储日志记录根本不起作用

[英]Azure Blob Storage logging not working at all

I was trying to setup logging for a container and followed the documentation by enabling Diagnostic settings (classic) .我试图为容器设置日志记录,并通过启用Diagnostic settings (classic)来遵循文档。 However, while the $logs folder is created it simply stayed empty (for hours), while uploading and downloading files.然而,在创建$logs文件夹时,它只是保持空(几个小时),同时上传和下载文件。

Am I missing something obvious?我错过了一些明显的东西吗?

Sometimes the logs may not appear in portal.Try checking $logs from azure storage explorer.有时日志可能不会出现在门户中。尝试从 azure 存储资源管理器检查 $logs。

or they can be viewed through powershell or programmatically also.或者它们可以通过 powershell 或以编程方式查看。

Ensure that the Delete data check box is selected.确保选中删除数据复选框。 Then, set the number of days that you would like log data to be retained.然后,设置您希望保留日志数据的天数。 Please check if retention policy is not set or set to 0,which may cause logs not to retain to show.请检查保留策略是否未设置或设置为 0,这可能导致日志不保留显示。

在此处输入图像描述

Reference: Enable and manage Azure Storage Analytics logs (classic) |参考: 启用和管理 Azure 存储分析日志(经典) | Microsoft Docs 微软文档

Its also good to note that application logs for few apps may not provide logs in blob storage and only can be done in file system which is why they use console.log('message') and console.error('message').还需要注意的是,少数应用程序的应用程序日志可能不会在 blob 存储中提供日志,只能在文件系统中完成,这就是他们使用 console.log('message') 和 console.error('message') 的原因。

If we want to write Application logs to Azure blob storage,firstly we need to enable Application log and configure blob storage for it on the Azure portal and keet its level to be verbose in some cases.如果我们想将应用程序日志写入 Azure blob 存储,首先我们需要在 Azure 门户上启用应用程序日志并为其配置 blob 存储,并在某些情况下使其级别保持详细。

Other references:其他参考:

  1. c# - ASP.NET Core Application Logs Not Written To Blob in Azure App Service - Stack Overflow c# - ASP.NET核心应用程序日志未写入Azure应用程序服务中的Blob - Thinbug
  2. logging - Azure WebApp Not Sending Application Logs to Blob Storage- Stack Overflow 日志记录 - Azure WebApp 未将应用程序日志发送到 Blob 存储 - 代码日志
  3. .net core - Azure WebJob not logging to blob storage - Stack Overflow .net核心 - Azure WebJob未记录到blob存储 - Thinbug

So if someone else stumbles across this and after some back-and-forth with technical support, the problem seems to be related to some storage account settings.因此,如果其他人偶然发现了这一点,并且在与技术支持来回反复之后,问题似乎与某些存储帐户设置有关。 In particular with storage-account wide immutability settings.特别是存储帐户范围的不变性设置。

What solved the problem for us was to disable immutability on the storage account level and to instead set it on the container level.为我们解决问题的是在存储帐户级别禁用不变性,而是在容器级别设置它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM