gpt4 book ai didi

logging - Grafana Loki 特定日志消息总数

转载 作者:行者123 更新时间:2023-12-05 01:23:19 26 4
gpt4 key购买 nike

我正在使用 Grafana Loki,我需要计算特定时间间隔内特定日志消息的总数。例如,我需要从 12:00:00 到 14:00:00 期间的日志消息“some-text”的总数。我刚刚找到了以下方法来计算最后一分钟的出现次数,如下所示:count_over_time({container="some-container"} |= "some-text")[1m],但我没有找到任何查询特定间隔的方法。

如果这是可能的并且有人可以提供帮助,我将非常高兴。

最佳答案

如果您使用 Grafana Explore要查询您的日志,您可以执行 instant 查询并使用时间范围和 global variables .

因此您可以选择时间范围,如下面的屏幕截图所示,您的查询将变为count_over_time({container="some-container"} |= "some-text"[$__range])

您可以在 Grafana Playground. 中查看我的示例 enter image description here

关于logging - Grafana Loki 特定日志消息总数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72607465/

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