【问题标题】:Topk values in LogQLLogQL 中的 Topk 值
【发布时间】:2021-10-09 15:26:59
【问题描述】:

我需要一些关于 Loki 的帮助。我有如下的 json 日志

{"message": {"reason": "reason1"...}}
{"message": {"reason": "reason2"...}}

我需要打印前 N 个原因。我该怎么做?

【问题讨论】:

    标签: grafana grafana-loki


    【解决方案1】:

    试试下面的 LogQL

    topk(N, sum by (reason) (count_over_time({filename="xxxxx"} | json [1d])))
    

    【讨论】:

      猜你喜欢
      • 2021-06-21
      • 2020-10-17
      • 1970-01-01
      • 2020-03-23
      • 2022-01-15
      • 2022-07-21
      • 2020-03-17
      • 2021-04-20
      • 2020-03-29
      相关资源
      最近更新 更多