Add unixtime on alert summary

is it possible to get unixtime on message?

I managed by following method with flux.

I added following line inside query.

|> set(key: "atime", value: strings.substring(v: string(v: uint(v: now())), start: 0, end: 13))

Query will be…

import "strings"
from(bucket: v.defaultBucket)
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "data")
  |> set(key: "atime", value: strings.substring(v: string(v: uint(v: now())), start: 0, end: 13))  
  |> filter(fn: (r) => r["_field"] == "state" or r["_field"] == "atime")
  |> aggregateWindow(every: 1m, fn: last, createEmpty: false)
  |> group(columns: ["jigloc","SN","atime"])
  |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")

Updated image 2023/01/28
ae8e3f73c4b173bfd6b13ee029e540a98c46ff36

1 Like

Thank you for sharing solution with us! It will be of great help for me since I wanted to do the same. :slight_smile:

Best regards,
ldrascic

1 Like