Kapacitor | How to change alert message duration format

I would like to change the format of the “{{ .Duration }}” variable (hours, minutes, seconds),
to : years, days, hours, minutes, seconds.


.message('Last state change (duration) was {{ .Duration }}.')

Capture d’écran 2022-09-02 120533


Hello @Julien-IpD,
Unfortunately I don’t think that’s an option:

@Emrys_Landivar can you please confirm?

Thank you

Hello @Anaisdg,

Thank you for your reply.

How do we define the units on the .Duration variable?
The desired format: Days, Hours, Minutes, Secondes.

Thank you

Hello @Julien-IpD,
I found:


    Duration – the duration of the alert in nanoseconds.

So looks like maybe you can’t specify the format. I think I was wrong.

Hello @Anaisdg,

I found the same info. Thanks anyway.

It might be good to correct or clarify this in the documentation.
Can you make a feature request to the developers?

Thank you

Hello @Julien-IpD,
I wouldn’t count on it. I’d suggest using Flux and 2.x instead.