Get count of each log contents

Hi, i have log file in grafana using loki data source the problem is i want to make table in grafana for specific messages in the log . multiple methods of msg in the logs. so i need two coloumn one is msg type or method another coulmn is count of each methods. in the screenshot i need to get count of that msg type how many time it occurs within the hour or minute.

This documentation could help.
Furthermore, rate gives you the occurs in a second, so you have to divide the result.

Maybe this query your solve you problem:

sum by(msg) (rate({} 
   | json msg="log.msg" 
   | msg != `` 
[$__range])) 

And you must select queryType instant.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.