Topk values in LogQL
Mia Lopez
I need some help with Loki. I`ve got json logs like following
{"message": {"reason": "reason1"...}}
{"message": {"reason": "reason2"...}}And I need to print top N reasons. How can I do this?
1 Answer
Try the following LogQL
topk(N, sum by (reason) (count_over_time({filename="xxxxx"} | json [1d]))) 5