grafana loki特定日志消息的总数
我正在使用Grafana Loki,需要计算特定时间间隔的特定日志消息的总数。例如,我需要在12:00:00至14:00:00的期间内的日志消息“某些文本”的总数。我刚刚找到了以下方法来计算最后一分钟的出现,这是:count_over_time({container =“ some-containter”} | =“ some-text”)[1M]
,但是我没有找到任何查询特定间隔的方法。
如果可能的话,我会很高兴,有人可以提供帮助。
I am using Grafana Loki and I need to calculate the total number of a certain log message for a specific time interval. For example, I need the total number of log message "some-text" in the period from 12:00:00 to 14:00:00. I just found the following way to count the occurrences of the last minute, something this: count_over_time({container="some-containter"} |= "some-text")[1m]
, but i did not found any way to query a specific interval.
I would be very happy if this is possible and someone could help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您正在使用 grafana explore 查询日志,您可以做
>
> instant
查询并使用时间范围,全局变量。因此,您可以选择下面屏幕截图中看到的时间范围,您的查询将变成
count_over_time({container =“ some-container”} | =“ some-text” [$ __范围])
您可以在“ noreferrer”> grafana游乐场。

If you're using Grafana Explore to query your logs you can do an
instant
query and use the time range and global variables.So you can select the time range as seen in the screenshot below and your query would become
count_over_time({container="some-container"} |= "some-text"[$__range])
You can check my example in the Grafana Playground.
