How to sum/count the total number of occurrence of particular string or pattern in Grafana-Loki

156 Views Asked by At

In Grafana, I am searching for total no of occurance of particualr string / pattern like below {k8s_cluster="mycluster", namespace="mynamespace", app="myappname"} |= Event received: Type myevent, Key |= \"sourceSystem\":\"mysystem\" | json

Now I need to get the sum/total count of this pattern present in logs say in last 1 hour or two hour.

I tried to use count over time and sum but I am not seeing the same count so I need help to achieve this. If I simply searches in last oone hour without any aggregiation in logs I can see 200 or 300 occurances but if it is more than 1000 it wont comes so I need to get the count/sum so need aggrigation function to work on this.

0

There are 0 best solutions below