LogQL 中的 Topk 值
Topk values in LogQL
我需要一些关于 Loki 的帮助。我有 json 如下日志
{"message": {"reason": "reason1"...}}
{"message": {"reason": "reason2"...}}
而且我需要打印前 N 个原因。我该怎么做?
试试下面的 LogQL
topk(N, sum by (reason) (count_over_time({filename="xxxxx"} | json [1d])))
我需要一些关于 Loki 的帮助。我有 json 如下日志
{"message": {"reason": "reason1"...}}
{"message": {"reason": "reason2"...}}
而且我需要打印前 N 个原因。我该怎么做?
试试下面的 LogQL
topk(N, sum by (reason) (count_over_time({filename="xxxxx"} | json [1d])))