Azure WebApp 不将应用程序日志发送到 Blob 存储
Azure WebApp Not Sending Application Logs to Blob Storage
我的团队有多个 Azure WebApps (Windows) 运行 Node.js 应用程序。我们正在使用 Winston 库 来记录服务 activity(例如,请求)。我们已在每个配置中配置诊断日志记录以将日志存储在 Blob 存储资源中。
使用Microsoft Azure 存储资源管理器,我们可以看到 Blob 存储中有多个容器。它似乎按小时收集信息,但只有 'snapshot' 个条目作为 CSV 文件和 .log 文件,几乎没有任何信息。文件很小,不应该是这种情况,因为流量是一致的,而且我们正在记录相当多的文件。
我们的日志记录以文件系统格式工作,但它显然不适用于 blob 存储。我们似乎无法找到我们的日志未存储在我们的存储帐户中的原因。
是否需要额外配置?
根据您的描述,我检查了您的问题,发现我只能通过 console.log
和 console.error
从 KUDU 路径 D:\home\LogFiles\Application\
获取日志记录。然后我在 azure web app 上发现 blog 提到了关于 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 WebApps (Windows) 运行 Node.js 应用程序。我们正在使用 Winston 库 来记录服务 activity(例如,请求)。我们已在每个配置中配置诊断日志记录以将日志存储在 Blob 存储资源中。
使用Microsoft Azure 存储资源管理器,我们可以看到 Blob 存储中有多个容器。它似乎按小时收集信息,但只有 'snapshot' 个条目作为 CSV 文件和 .log 文件,几乎没有任何信息。文件很小,不应该是这种情况,因为流量是一致的,而且我们正在记录相当多的文件。
我们的日志记录以文件系统格式工作,但它显然不适用于 blob 存储。我们似乎无法找到我们的日志未存储在我们的存储帐户中的原因。
是否需要额外配置?
根据您的描述,我检查了您的问题,发现我只能通过 console.log
和 console.error
从 KUDU 路径 D:\home\LogFiles\Application\
获取日志记录。然后我在 azure web app 上发现 blog 提到了关于 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 存储中。