Extracting GPS data from a log and using it in a panel as a metric

How to get GPS Labels converted to metrics in LogQL. Grafana 7.3.5
Raw log:
2021-01-27 17:44:31 vehicule=51 longitude=-70.1 latitude=45.1
I can extract it using:
{tag="TAG"} | logfmt
Which gives the following Labels to the log.
{tag="TAG", vehicule="51", latitude="45.1", longitude="-70.1}

I am stuck to figure out how to get latitude and longitude extracted as metrics and be used in a graph or a GPS map like Alexandra TrackMap. When I use unwrap and a function like avg_over_time all values are there. But I do not want to change the values, but simply pass the raw coordinates to the panel.

Help!

Note: I can extract the data using promtail and send it to a metric store, but I would rather do it as a logql function in Grafana.

(corrected because I indicated the wrong transformation, oups.)
I guess I have to reply to myself.
The trick is to use the grafana “Labels to Fields” Transformation. Nothing else, do not put anything in the input field.
Trackmap will recognize the metric names it wants and display the data as required. Simple but not documented anywhere, brrr
As long as your label names match up to what the plugin is looking for, it will work.

1 Like