Is it possible to embed {{ctx.trigger.scheduled_time}} variable in the reporting url inside a watcher script?

Hi All,

I have deployed a watcher script that triggered for certain search criteria. The action of the watch is to generate a dashboard.pdf and send it through email.

Now the problem is, I'm using two systems for this alert, one is watcher to trigger the alert and another is Kibana Reporting which generates the pdf report. Now for watcher triggering time is stored in {{ctx.trigger.scheduled_time}} variable but in the POST url, we are using "now". Because of this there is a mismatch found between the results of these two systems.

Please see below the watcher snippet.

"filter": {
                "range": {
                  "transaction_datetime": {
                    "gte": "{{ctx.trigger.scheduled_time}}||-5m",
                    "lte": "{{ctx.trigger.scheduled_time}}",
                    "format": "strict_date_optional_time||epoch_millis"
                  }

and below is the POST url snippet.
time%3A%28from%3Anow-5m%2Cto%3Anow%29
Now I'm trying to embed {{ctx.trigger.scheduled_time}} variable in the POST url so that both the systems will be in sync.

Is there any way by which I can embed the variable value into the POST url?

If you need more details regarding the logic or watcher script, please let me know.

Please help.

Regards,
Souvik

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