Azure 应用程序网关中的失败请求列表
List of failed requests in Azure application gateway
我们可以在 Azure 应用程序网关中看到失败的请求计数,但是我们如何在日志部分看到失败的请求列表?
在应用程序网关的诊断设置中启用所有日志。
我们至少需要在应用程序网关的日志部分看到请求的路径 (URL) 和失败请求的响应代码。
由于访问日志存储在存储帐户中的方式(文件夹结构),通过存储帐户访问所需数据有点困难。
Taken from this doc, you should see the requested URL and return code in the access log. The access log 仅当您在每个应用程序网关实例上启用它时才会生成。每 300 秒收集一次访问日志。可能是日志数据更新有延迟。
Access log: You can use this log to view Application Gateway access
patterns and analyze important information. This includes the caller's
IP, requested URL, response latency, return code, and bytes in and
out. An access log is collected every 300 seconds. This log contains
one record per instance of Application Gateway. The Application
Gateway instance is identified by the instanceId property.
这可以通过 运行 日志中的以下查询来实现,我有一个关于同一主题的博客 post here
// Errors by URI
// Number of errors by URI.
AzureDiagnostics
| where ResourceType == "APPLICATIONGATEWAYS" and OperationName == "ApplicationGatewayAccess" and httpStatus_d > 399
| summarize AggregatedValue = count() by requestUri_s
| sort by AggregatedValue desc
我们可以在 Azure 应用程序网关中看到失败的请求计数,但是我们如何在日志部分看到失败的请求列表?
在应用程序网关的诊断设置中启用所有日志。
我们至少需要在应用程序网关的日志部分看到请求的路径 (URL) 和失败请求的响应代码。
由于访问日志存储在存储帐户中的方式(文件夹结构),通过存储帐户访问所需数据有点困难。
Taken from this doc, you should see the requested URL and return code in the access log. The access log 仅当您在每个应用程序网关实例上启用它时才会生成。每 300 秒收集一次访问日志。可能是日志数据更新有延迟。
Access log: You can use this log to view Application Gateway access patterns and analyze important information. This includes the caller's IP, requested URL, response latency, return code, and bytes in and out. An access log is collected every 300 seconds. This log contains one record per instance of Application Gateway. The Application Gateway instance is identified by the instanceId property.
这可以通过 运行 日志中的以下查询来实现,我有一个关于同一主题的博客 post here
// Errors by URI
// Number of errors by URI.
AzureDiagnostics
| where ResourceType == "APPLICATIONGATEWAYS" and OperationName == "ApplicationGatewayAccess" and httpStatus_d > 399
| summarize AggregatedValue = count() by requestUri_s
| sort by AggregatedValue desc