I have a Grafana dashboard that includes a panel which groups like error messages from Loki to display the most common errors. However, I get a lot of like messages that are not grouped due to variable data. For example: "User ID '123456' is of a type that is not found in the DB". If this error occurs for 50 users, I want to report it as 50 occurrences of the same error but instead, it shows it as 50 separate errors because the User ID is unique for each.
- Is there a way to have Grafana recognize the pattern but ignore the dissimilar portion?
- Is there a way to structure the LogQL query to ignore text within single quotes?
My current LogQL query is:
topk(10, sum(count_over_time({cluster=~"${cluster:regex}", namespace=~"${namespace:regex}"} [$__range] | json | __error__ = "" ) ) by (MessageTemplate))