How to set Time range in Watcher

Hello Elastic Team,

I am trying to set time range in my below watcher configuration but i am getting an error while configuring the Watcher could you please assist.

Watcher Configuration

{
  "trigger": {
    "schedule": {
      "interval": "1d"
    }
  },
  "input": {
    "none": {}
  },
  
  "range": {
    "@timestamp": {
       "gte": "now-3m"
      }
     }
   },
  "condition": {
    "always": {}
  },
  "actions": {
    "email_admin": {
      "email": {
        "account": "exchange_account",
        "profile": "outlook",
        "attachments": {
          "payments_dashboard.pdf": {
            "reporting": {
              "url": "https://113aff96d90e42f59d2d1c8963267d8e.elk-dev.lowes.com:9243/api/reporting/generate/printablePdf?jobParams=(browserTimezone:UTC,layout:(dimensions:(height:1100,width:1632),id:preserve_layout),objectType:dashboard,relativeUrls:!(%27%2Fapp%2Fkibana%23%2Fdashboard%2F23fdf660-3bbf-11ea-9a4f-dfd98f1e40a2%3F_g%3D(refreshInterval:(pause:!!f,value:10000),time:(from:now-1h,to:now))%26_a%3D(description:!%27!%27,filters:!!(),fullScreenMode:!!f,options:(hidePanelTitles:!!f,useMargins:!!t),panels:!!((embeddableConfig:(),gridData:(h:9,i:!%2769f93113-56ce-4d99-9b8d-b2f67641d299!%27,w:17,x:0,y:0),id:!%276265b9b0-3967-11ea-9a4f-dfd98f1e40a2!%27,panelIndex:!%2769f93113-56ce-4d99-9b8d-b2f67641d299!%27,type:visualization,version:!%277.5.0!%27),(embeddableConfig:(),gridData:(h:9,i:!%278a5ad32a-c8d1-4686-a41d-08e6be90ec75!%27,w:15,x:17,y:0),id:!%274d43b160-396a-11ea-9a4f-dfd98f1e40a2!%27,panelIndex:!%278a5ad32a-c8d1-4686-a41d-08e6be90ec75!%27,type:visualization,version:!%277.5.0!%27),(embeddableConfig:(),gridData:(h:9,i:!%2726b99694-ffaa-408a-b93a-4c9ee57bbc5e!%27,w:16,x:32,y:0),id:faa15d90-3969-11ea-9a4f-dfd98f1e40a2,panelIndex:!%2726b99694-ffaa-408a-b93a-4c9ee57bbc5e!%27,type:visualization,version:!%277.5.0!%27),(embeddableConfig:(),gridData:(h:15,i:!%27282239bd-221e-4a49-9885-0f5de2180063!%27,w:24,x:0,y:9),id:daf5f320-3bc1-11ea-9a4f-dfd98f1e40a2,panelIndex:!%27282239bd-221e-4a49-9885-0f5de2180063!%27,type:visualization,version:!%277.5.0!%27),(embeddableConfig:(),gridData:(h:15,i:!%271c6d75e9-2198-4f0e-9c4e-7ccf360f2586!%27,w:24,x:24,y:9),id:!%276565d820-3bc9-11ea-9a4f-dfd98f1e40a2!%27,panelIndex:!%271c6d75e9-2198-4f0e-9c4e-7ccf360f2586!%27,type:visualization,version:!%277.5.0!%27),(embeddableConfig:(timeRange:(from:now-2d,to:now),title:!%27Approval%2BCount%2BBy%2BHour%2BOver%2BTime!%27),gridData:(h:15,i:!%27226c612d-754e-423e-871d-ccd32f400ed6!%27,w:24,x:0,y:24),id:ae5765d0-3bc9-11ea-9a4f-dfd98f1e40a2,panelIndex:!%27226c612d-754e-423e-871d-ccd32f400ed6!%27,title:!%27Approval%2BCount%2BBy%2BHour%2BOver%2BTime!%27,type:visualization,version:!%277.5.0!%27),(embeddableConfig:(),gridData:(h:15,i:b86f8365-714f-4064-bfe2-f0926246a59f,w:24,x:24,y:24),id:cdaeb340-3bd6-11ea-9a4f-dfd98f1e40a2,panelIndex:b86f8365-714f-4064-bfe2-f0926246a59f,type:visualization,version:!%277.5.0!%27)),query:(language:kuery,query:!%27!%27),timeRestore:!!t,title:!%27Payments%2BSwitch%2B-%2BAuthorization%2BOverview!%27,viewMode:view)%27),title:%27Payments%20Switch%20-%20Authorization%20Overview%27)",
              "retries": 7,
              "interval": "10s",
              "auth": {
                "basic": {
                  "username": "xxxx",
                  "password": "xxxx"
                }
              }
            }
          }
        },
        "from": "xxxxxxxxxxxxxx",
        "to": [
          "xxxxxxxxxxxx"
        ],
        "subject": "Payments Dashboard - Authorization Overview",
        "body": {
          "text": "Sample PDF Dashboard Sent Via Watcher to Email"
        }
      }
    }
  }
} 

Error

Error[parse_exception] could not parse watch [1994659d-c7d9-468d-be1c-76ba75852da7]. unexpected field [range]

Regards,
Santosh Kumar Das

Hello Team,

Can somebody please help for my issue.

Regards,
Santosh Das

The watcher content you have posted is not valid JSON. Are you sure that is a verbatim copy of what you are trying to send?

Something strange is going on around the range field. Watcher doesn't accept a range field in the body like that, and you've got an extra closing bracket (}) there as well.

Yes , could you please help me with right configuration.

if possible please modify my above configuration i want to set my time range in watcher.

//BR

Santosh

The body field of the search input needs to contain the query you want to sent.

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