Topk Values in Logql
I Need Some Help with Loki. I`ve Got Json Logs Like Following {"Message": {"Reason": "Reason1". .. }} {"Message": {"Reason": "Reason2". .. }} and I Need to...
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])))