在以前的工作场所使用过 New Relic 和最近的 DataDog,现在我正在尝试了解 Azure 的应用程序洞察。
是否有任何方法可以在与下面的屏幕截图类似的仪表板中查看 Application Insights 中的所有日志,即按日期时间顺序查看所有日志,并能够按自定义值进行过滤,例如服务名称、日志级别等?
是的,Azure Application Insights 提供了一项名为“日志分析”的功能,可让您以灵活的方式查询和查看日志。以下是如何获得与您所描述的类似的视图:
访问日志分析:
导航到 Azure 门户中的 Application Insights 资源。 在“监控”部分下,单击“日志”。 查询您的日志:
Application Insights 使用一种称为 Kusto 查询语言 (KQL) 的查询语言。您可以使用 KQL 来过滤、排序和分析日志。 例如,要按日期时间顺序查看所有跟踪:
traces
| order by timestamp desc
To filter by custom values like service name or log level:
traces
| where customDimensions["ServiceName"] == "YourServiceName"
| where severityLevel == "Information"
| order by timestamp desc
自定义您的视图:
您可以将查询结果固定到共享仪表板或将其导出以进行进一步分析。 Application Insights 还提供了一项名为“工作簿”的功能,允许您根据日志创建自定义交互式报告和可视化效果。 附加过滤器:
在日志分析页面的顶部,有可用于时间范围的过滤器,您还可以设置自定义时间范围。 您还可以使用左侧的“架构”窗格来探索日志中可用的不同表格和列。
如果您喜欢我的回答,请点赞...
Azure Application Insights 提供了一套丰富的工具来监视、分析和可视化日志数据,尽管 UI 可能有所不同,但功能与 New Relic 和 DataDog 等平台非常相似。
您可以在 Application Insights 中查看和筛选日志:
按时间顺序查看日志:
traces
| order by timestamp desc
按自定义值过滤:
您可以使用 KQL 中的
where
子句过滤日志。例如,按特定日志级别过滤日志:
traces
| where customDimensions.LogLevel == "Error"
| order by timestamp desc
同样,按服务名称过滤:
traces
| where customDimensions.ServiceName == "MyService"
| order by timestamp desc
可视化日志:
固定到仪表板:
搜索: