'Create bar chart for average value of a field by label?
I have Promtail set up on my servers to label log lines by host, endpoint, etc. and Loki to extract response times from these log lines as a field.
Here's a sample log from the explorer in Grafana:

What I want to do is turn these logs into a bar chart, showing average response time (action_time_ms) by endpoint.
I've found the metric queries page in the Loki LogQL docs, but I'm not sure how to turn that into the right kind of query for Grafana to make a bar chart out of it. Do fields even matter?
Grafana v8.4.2, Loki/Promtail v2.4.2.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
