Dynamic date to Watcher email

Hi

I want to add a date to the watcher command shown below right into the file name without having to type in a different one manually all the time. E.g. PM2.5_arista_report_24Mar22. Is there any way that you can help me with this please?

PUT _watcher/watch/arista_dash
{
  "trigger" : {
    "schedule": {
      "daily" : { "at" : "01:15" }
    }
  },
  "actions" : {
    "email_admin" : { 
      "email": {
        "to": "'Angad Panesar <a.p@mm.co.uk>'",
        "subject": "Arista PDF",
        "attachments" : {
          "PM2.5_arista_report_{date-1}.pdf" : {
            "reporting" : {
              "url": "https://staging-mc.kb.us-east-1.aws.found.io:9243/api/reporting/generate/printablePdfV2?jobParams=%28browserTimezone%3AEurope%2FLondon%2Clayout%3A%28dimensions%3A%28height%3A484%2Cwidth%3A2240%29%2Cid%3Aprint%29%2ClocatorParams%3A%21%28%28id%3ADASHBOARD_APP_LOCATOR%2Cparams%3A%28dashboardId%3Acac77490-a11f-11ec-b343-85a4ccf2c798%2Cfilters%3A%21%28%28%27%24state%27%3A%28store%3AappState%29%2Cmeta%3A%28alias%3A%21n%2Cdisabled%3A%21f%2Cindex%3Ab5f332d0-43c7-11ec-b5ab-fbc66f2b8ddf%2Ckey%3Aplace%2Cnegate%3A%21f%2Cparams%3A%21%28Arista%29%2Ctype%3Aphrases%29%2Cquery%3A%28bool%3A%28minimum_should_match%3A1%2Cshould%3A%21%28%28match_phrase%3A%28place%3AArista%29%29%29%29%29%29%29%2CpreserveSavedFilters%3A%21t%2CtimeRange%3A%28from%3Anow-24h%2Cto%3Anow%29%2CuseHash%3A%21f%2CviewMode%3Aview%29%2Cversion%3A%278.0.0%27%29%29%2CobjectType%3Adashboard%2Ctitle%3A%27PM2.5%20REPORT%27%2Cversion%3A%278.0.0%27%29",
              "retries":40, 
              "interval":"15s", 
              "auth":{ 
                "basic":{
                  "username":"angad",
                  "password":"xxxx"
                }
              }
            }
          }
        }
      }
    }
  }
}

Regards

Angad

Hey,

that field is not dynamic and cannot be scripted unfortunately. Feel free to open an issue in the Elasticsearch repo as a feature request.

--Alex

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