How to capture "now" and "now-15m" in mail body?

Hi All,

I am trying to capture the time "now" and "now-15m" in my mail body of the kibana watcher. Can you help me with the syntax?

Thanks & Regards,
Debashis

Hey,

the definition of now is internal to an Elasticsearch query and not exposed. If it is ok to have a value that is nearby, you could use the execution time of the watch context by using {{ctx.execution_time}}.

hope this helps

--Alex

Hi Alex,

Thanks for answering the query. Is there any way we can calculate "{{ctx.execution_time}}-15 minutes" in the mail body?

Thanks & Regards,
Debashis Adak

you could do a transform before the action and do sth like

def x = Instant.ofEpochMilli(ctx.execution_time.getMillis()).plusSeconds(60*15)

Note: untested, on top of my head.

--Alex

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.