gpt4 book ai didi

Azure Log Analytics - 如何查看最近 x 天但仅在特定时间之间的日志?

转载 作者:行者123 更新时间:2023-12-02 23:16:18 24 4
gpt4 key购买 nike

我想查看过去 x 天的应用网关 500 错误日志。但对于这 x 天,我只想查看 UTC 时间 11:00 到 13:00 之间出现的日志。我怎样才能做到这一点?这是我到目前为止所拥有的,但它不起作用。

AzureDiagnostics
| where TimeGenerated > ago(7d) and TimeGenerated between (datetime(11:00:00) .. datetime(13:00:00))
| where ResourceType == "APPLICATIONGATEWAYS" and httpStatus_d > 499
| where host_s == "my.website.com"
| summarize count() by clientIP_s, bin(TimeGenerated, 5m)

显然第二个(Time generated)是错误的。有人可以建议如何做到这一点吗?

谢谢!

最佳答案

您可以使用hourofday():https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/hourofdayfunction

例如:

AzureDiagnostics
| where TimeGenerated > ago(7d)
| where hourofday(TimeGenerated) between (11 .. 12) // 11:00 AM -> 12:59 PM
| where host_s == "my.website.com"
| where ResourceType == "APPLICATIONGATEWAYS"
| where httpStatus_d > 499
| summarize count() by clientIP_s, bin(TimeGenerated, 5m)

关于Azure Log Analytics - 如何查看最近 x 天但仅在特定时间之间的日志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65257311/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com