- What Grafana version and what operating system are you using?
Grafana 13 + Influxdb v2 + Debian
- What are you trying to achieve?
I have calculated a time duration via flux. This duration has ms, us and ns. I want to truncate those or transform this field so that only days, hours and minutes are shown.
This is how it looks:
and this is what i want (or something similar)
my query:
from(bucket: "firewall")
|> range(start: -120d)
|> filter(fn: (r) => r["host"] == "firewall.homelab.lan")
|> filter(fn: (r) => r["_measurement"] == "interface")
|> filter(fn: (r) => r["friendlyname"] == "WAN")
|> filter(fn: (r) => r["_value"] == 0)
|> last()
|> map(fn: (r) => ({ r with current_timestamp: uint(v: now())}))
|> map(fn: (r) => ({ r with event_timestamp: uint(v: r._time) }))
|> map(fn: (r) => ({ r with time_since_event: string(v: duration(v: r.current_timestamp - r.event_timestamp))}))
|> map(fn: (r) => ({_time_since_event:r.time_since_event}))


