未找到 Azure Functions 服务器错误指标日志

问题描述 投票:0回答:1

我有一个独立的 Azure 函数应用程序,带有服务器错误的指标警报。当我发布 Azure 函数时,有时会触发警报。但是,我在“跟踪”或“异常”表下的应用程序洞察中找不到与服务器错误相关的任何日志。如何获取服务器错误指标日志?

azure-functions azure-application-insights
1个回答
0
投票

我部署了一个函数应用程序并创建了用于记录的 HTTP 500 错误:-

enter image description here

您可以通过检查函数应用程序的“配置”选项卡中是否存在 APPINSIGHTS_INSTRUMENTATIONKEY 设置来验证您的函数应用程序是否启用了 Application Insights,如下所示:-

enter image description here

我去了 Metric 部分,并且能够检索 HTTP 服务器错误的所有指标图,如下所示:-

我将范围从我的 Azure Function 应用程序更改为 application insights 连接到 Function 应用程序以获取如下 HTTP 指标:-

enter image description here

  1. 获取服务器异常的指标:-

enter image description here

  1. 获取 HTTP 失败和成功请求的指标:-

enter image description here

enter image description here

在“功能监控”选项卡中验证相同,如下所示:-

enter image description here

  1. 您可以在下面找到与服务器相关的指标:-

enter image description here

enter image description here

此外,您可以通过单击 Function 应用程序左侧的日志选项卡并检查 HTTP 服务器日志来检查请求表中的日志。

在 Application insights 中单击运行查询:-

enter image description here

运行查询并检查请求表:-

enter image description here

requests
| project
    timestamp,
    id,
    operation_Name,
    success,
    resultCode,
    duration,
    operation_Id,
    cloud_RoleName,
    invocationId=customDimensions['InvocationId']
| where timestamp > ago(30d)
| where cloud_RoleName =~ 'silixonfunctionapp' and operation_Name =~ 'HttpTrigger1'
| order by timestamp desc
| take 20

您还可以从左侧查看其他日志:-

enter image description here

如果指标仍未填充日志,您可以检查 Application Insights 工作区中的 Performance 选项卡,如下所示:-

enter image description here

单击上方的 HTTP 触发器,您的 Azure Function 应用程序的端到端事务将打开以供检查,如下所示:-

enter image description here

参考:-

为 Azure Functions 配置监控 |微软学习

© www.soinside.com 2019 - 2024. All rights reserved.