I have a PLG stack which extracts the Nginx logs (which is in json format) and visualize it in Grafana.
I want to create a dashboard in Grafana, where I get latency for different routes.
For this I am using the query:
min_over_time({job="nginx"}
| json
| unwrap request_time [1m])
by (request_uri)
But I noticed I have some routes which have dynamic values, for example /route1/?name=adarsh. So this route is also popping up in my dashboard which I don't want: I want it to get aggregated in into /route1/.
Using
| label_formatexpression andregexReplaceAlltemplate function it is possible to introduce an additional labelsanitized_request_uriwith removed parameters:If you experiencing issues with trailing
/in request URIs, preventing proper grouping, they can be dropped with addition of following expressionafter first
label_formatexpression.