I want to create a graph using value (res-time:11.649 ms) from loki logs. Below are log field.
access: 2024-06-19 06:41:46:479 GMT+0 | 06bf1499-c0ea-4927-b1ea-910ad9c87bf4 | ::ffff:172.28.12.236 | - | - | Dart/3.2 (dart:io) | method:POST | endpoint:/v1/authentication/getAccessToken | status-code:200 | res-time:11.649 ms | res-length:451
Try something like this (not tested):
avg_over_time( {SELECTOR} | regexp `.+(res-time\:)(?P<res_time>[\w\.]+)` | unwrap res_time )
If your res-time is always in ms unit then you can stop here, but if it can change (ms, s, min, etc) you may have to do some conversion yourself, or try the template function duration_seconds (see Template functions | Grafana Loki documentation).
ms
duration_seconds
Do we have other process ?