Azure WebApp 不将应用程序日志发送到 Blob 存储

标签 azure logging azure-web-app-service azure-blob-storage azure-diagnostics

我的团队有多个运行 Node.js 应用程序的 Azure WebApps (Windows)。我们使用 Winston 库来记录服务事件(例如请求)。我们已在每个中配置诊断日志记录以将日志存储在 Blob 存储资源中。

使用Microsoft Azure Storage Explorer,我们可以看到Blob存储中有多个容器。它似乎按小时收集信息,但只有 CSV 文件和 .log 文件形式的“快照”条目,几乎没有任何信息。文件很小,但事实并非如此,因为流量是一致的,而且我们正在记录相当多的数据。

我们的日志记录适用于文件系统格式,但显然不适用于 blob 存储。我们似乎找不到日志没有存储在存储帐户中的原因。

是否需要额外配置?

最佳答案

根据您的描述,我检查了您的问题,发现只能通过 KUDU 路径中的 console.logconsole.error 获取日志记录 D:\home\LogFiles\Application\。然后我找到了一个blog提到了 Azure Web 应用程序上的 Node.js 应用程序日志,如下所示:

Setting application logs in the Azure portal

For node.js websites the way to write application logs is by writing to the console using console.log('message') and console.error('message') which goes to Information/Error level log entries. Currently the only supported target for the log files for node.js is the file system.

Other web site types like php and python are not supported for the application logs feature.

这是一个适用于流行的 Nodejs 记录器的 Azure Blob 存储适配器,例如温斯顿:winston-azure-blob-transport ,您可以利用它作为解决方法,将应用程序日志从 Node.js 网站收集到 Azure Blob 存储中。

关于Azure WebApp 不将应用程序日志发送到 Blob 存储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44727570/

相关文章:

logging - Kubernetes Pod 中的日志未显示

elasticsearch - 忽略旧文件,并使用logstash仅推送来自S3的最新日志文件

azure - 调试 Azure WebApp 中的 TCP/IP 端口耗尽

python - 从 check_output 中抑制标准输出,而是将其写入日志

azure - 如何识别两个不同的应用服务

azure - 无法通过 FTP 访问 Azure Web 应用程序

C#:通过 MS Graph 下载 Sharepoint 文件返回未经授权

c# - Pechkin 与 Windows Azure

azure - 事件中心的入站 IP 是什么?

azure - 存储重播数据的最佳方式