是否可以将 Windows 事件日志获取到应用程序洞察中?

时间:2021-04-29 06:35:59

标签: azure azure-application-insights event-log azure-log-analytics azure-monitoring

我们的应用程序中运行了应用程序洞察(内部部署并托管在 azure 中),并且我们正在发送遥测数据,没有问题、不同的资源、常规数据、页面视图、异常、跟踪等,最近我被要求增加遥测数据添加 Windows 事件日志(来自事件查看器),但是,老实说,我对 azure 或应用程序见解以及所有文档都很陌生,我觉得这有点令人困惑,因为我发现所有关于 azure 监视器、日志分析工作区配置的讨论,但没有什么足够清楚(至少对我而言)指出我将这些数据专门记录到应用程序洞察资源中。这有可能实现吗?像添加 nuget 包并配置 applicationInsights.config 之类的东西?

<块引用>

更新...我已按照您的建议进行操作,并为 EtwCollectorTelemetryModule 添加了 nuget 包,并修改了 applicationInsights.config 文件。

现在的样子:
<Add Type="Microsoft.ApplicationInsights.EtwCollector.EtwCollectorTelemetryModule, Microsoft.ApplicationInsights.EtwCollector"> <Sources <Add ProviderName="Microsoft-Windows-Eventlog" Level="Warning" /> </Sources>

但是,我仍然无法在 traces 表中看到任何类型的日志(如果我理解正确,日志将发送到该表。)我是否需要初始化此模块才能开始跟踪这些日志? 还是我做错了什么?

1 个答案:

答案 0 :(得分:1)

我同意@Peter Bons 的观点。当您需要将 Windows 事件日志添加到 Azure 应用洞察时,您需要在配置文件中添加 ETW 模块。

请注意,EtwCollectorTelemetryModule 是一个 asp.net module,因此它适用于 asp.net 应用程序。

如果你的程序是用asp.net编写的,可以参考this tutorial修改配置。请注意,文档中提到的 Add Application Insights Telemetry 是“右键单击项目并单击配置 Application Insights”操作

enter image description here