# Watcher POST URL Error

**URL:** https://discuss.elastic.co/t/watcher-post-url-error/251067
**Category:** Kibana
**Created:** [October 6, 2020, 5:07am UTC](https://discuss.elastic.co/t/watcher-post-url-error/251067 "2020-10-06T05:07:22Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![karnamonkster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karnamonkster/32/67266_2.png) [@karnamonkster](https://discuss.elastic.co/u/karnamonkster)
#### Post date: [October 6, 2020, 5:07am UTC](https://discuss.elastic.co/t/watcher-post-url-error/251067/1 "2020-10-06T05:07:22Z")

</div>

Hi,

> Setup: ES/Kibana 7.5.2

We are trying to configure automatic PDF report generation and sent to the email on a schedule.  
The dashboard pdf works fine if we simply download it using **Generate PDF** option.  
However when using the POST Url for the Dashboard in Watcher it throws the error

Here is the configuration of the Watch.

```
{
  "trigger": {
    "schedule": {
      "interval": "1m"
    }
  },
  "input": {
    "none": {}
  },
  "condition": {
    "always": {}
  },
  "actions": {
    "email_admin": {
      "email": {
        "profile": "standard",
        "attachments": {
          "error_report.pdf": {
            "reporting": {
              "url": "http://NGINXIP/otwater/api/reporting/generate/printablePdf?jobParams=(browserTimezone:Asia%2FDubai,layout:(dimensions:(height:300,width:2066.45849609375),id:preserve_layout),objectType:visualization,relativeUrls:!(%27%2Fapp%2Fkibana%23%2Fvisualize%2Fedit%2F4019c4c0-8dad-11e9-96c9-bfdd3cee8fc8%3F_g%3D(filters:!!(),refreshInterval:(pause:!!t,value:0),time:(from:now-4d,to:now))%26_a%3D(filters:!!(),linked:!!f,query:(language:lucene,query:!%27!%27),uiState:(),vis:(aggs:!!(),params:(axis_formatter:number,axis_position:left,axis_scale:normal,background_color_rules:!!((id:b8fe36b0-8dac-11e9-9d4b-f52707f2360f)),bar_color_rules:!!((id:ca629360-8dac-11e9-9d4b-f52707f2360f)),default_index_pattern:!%27filebeat-*!%27,gauge_color_rules:!!((id:cf9d61c0-8dac-11e9-9d4b-f52707f2360f)),gauge_inner_width:10,gauge_style:half,gauge_width:10,id:!%2761ca57f0-469d-11e7-af02-69e470af7417!%27,index_pattern:!%27amialerts-*!%27,interval:auto,series:!!((axis_position:right,chart_type:line,color:%252368BC00,fill:0.5,formatter:number,id:!%2761ca57f1-469d-11e7-af02-69e470af7417!%27,line_width:1,metrics:!!((id:!%2761ca57f2-469d-11e7-af02-69e470af7417!%27,type:count)),point_size:1,separate_axis:0,split_color_mode:rainbow,split_mode:terms,stacked:none,terms_field:area.keyword)),show_grid:1,show_legend:1,time_field:cdate,type:timeseries),title:!%272019%2B-Training%2BTrend!%27,type:metrics))%27),title:%272019%20-Training%20Trend%27)",
              "retries": 4,
              "interval": "15s",
              "auth": {
                "basic": {
                  "username": "elastic",
                  "password": "::es_redacted::"
                }
              }
            }
          }
        },
        "to": [
          "myemailaddress@company.com"
        ],
        "subject": "Monitoring Report"
      }
    }
  }
}

```

When i execute/simulate this, we get the following error

> POST \_watcher/watch/e833ed0e-31b8-40ce-8644-08835346f34b/\_execute

```
{
      "_id" : "e833ed0e-31b8-40ce-8644-08835346f34b_e8944eac-ed34-4c7c-8ee7-ad53286a7dca-2020-10-06T04:43:26.199964Z",
      "watch_record" : {
        "watch_id" : "e833ed0e-31b8-40ce-8644-08835346f34b",
        "node" : "uhS6MPqkSjCmpKYpzS84Kw",
        "state" : "executed",
        "user" : "myuser",
        "status" : {
          "state" : {
            "active" : true,
            "timestamp" : "2020-10-06T04:42:13.405Z"
          },
          "last_checked" : "2020-10-06T04:43:26.199Z",
          "last_met_condition" : "2020-10-06T04:43:26.199Z",
          "actions" : {
            "email_admin" : {
              "ack" : {
                "timestamp" : "2020-10-06T04:42:13.405Z",
                "state" : "awaits_successful_execution"
              },
              "last_execution" : {
                "timestamp" : "2020-10-06T04:43:26.199Z",
                "successful" : false,
                "reason" : ""
              }
            }
          },
          "execution_state" : "executed",
          "version" : 1268
        },
        "trigger_event" : {
          "type" : "manual",
          "triggered_time" : "2020-10-06T04:43:26.199Z",
          "manual" : {
            "schedule" : {
              "scheduled_time" : "2020-10-06T04:43:26.199Z"
            }
          }
        },
        "input" : {
          "none" : { }
        },
        "condition" : {
          "always" : { }
        },
        "metadata" : {
          "name" : "UFW Automated Report",
          "xpack" : {
            "type" : "json"
          }
        },
        "result" : {
          "execution_time" : "2020-10-06T04:43:26.199Z",
          "execution_duration" : 10,
          "input" : {
            "type" : "none",
            "status" : "success",
            "payload" : { }
          },
          "condition" : {
            "type" : "always",
            "status" : "success",
            "met" : true
          },
          "actions" : [
            {
              "id" : "email_admin",
              "type" : "email",
              "status" : "failure",
              "error" : {
                "root_cause" : [
                  {
                    "type" : "exception",
                    "reason" : "Watch[e833ed0e-31b8-40ce-8644-08835346f34b] reporting[error_report.pdf] Error response when trying to trigger reporting generation host[NGINXIP], port[80] method[POST], path[/otwater/api/reporting/generate/printablePdf], status[301]"
                  }
                ],
                "type" : "exception",
                "reason" : "Watch[e833ed0e-31b8-40ce-8644-08835346f34b] reporting[error_report.pdf] Error response when trying to trigger reporting generation host[NGINXIP], port[80] method[POST], path[/otwater/api/reporting/generate/printablePdf], status[301]"
              }
            }
          ]
        },
        "messages" : []
      }
    }

```

Any help would be highly appreciated.

---

<div class="post-metadata">

### Author: ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)
#### Post date: [October 6, 2020, 3:30pm UTC](https://discuss.elastic.co/t/watcher-post-url-error/251067/2 "2020-10-06T15:30:03Z")

</div>

> [@karnamonkster](#):
>
> `Watch[e833ed0e-31b8-40ce-8644-08835346f34b] reporting[error_report.pdf] Error response when trying to trigger reporting generation host[NGINXIP], port[80] method[POST], path[/otwater/api/reporting/generate/printablePdf], status[301]`

cc @tsullivan

HTTP code 301 is not an error. It’s a permanent redirect. I would recommend rechecking your ngnix config. cc @tsullivan

Thanks  
Rashmi

---

<div class="post-metadata">

### Author: ![karnamonkster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karnamonkster/32/67266_2.png) [@karnamonkster](https://discuss.elastic.co/u/karnamonkster)
#### Post date: [October 6, 2020, 4:27pm UTC](https://discuss.elastic.co/t/watcher-post-url-error/251067/3 "2020-10-06T16:27:45Z")

</div>

Hi Rashmi,  
What would be the additional config parameters for this to work.?  
I was under impression that the same job gets processed with a schedule(watcher) when we download a dashboard report as PDF.

Any example I can refer to?

---

<div class="post-metadata">

### Author: ![karnamonkster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karnamonkster/32/67266_2.png) [@karnamonkster](https://discuss.elastic.co/u/karnamonkster)
#### Post date: [October 11, 2020, 5:37am UTC](https://discuss.elastic.co/t/watcher-post-url-error/251067/4 "2020-10-11T05:37:19Z")

</div>

@tsullivan @rashmi

Hello,

Was wondering if there is anything in need to do on my NGINX configuration? I also have a support ticket on this opened if you can refer to that Ref [00618891](https://support.elastic.co/customers/s/case/5004M00000ejWVpQAM)

---

<div class="post-metadata">

### Author: ![karnamonkster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karnamonkster/32/67266_2.png) [@karnamonkster](https://discuss.elastic.co/u/karnamonkster)
#### Post date: [October 20, 2020, 5:38am UTC](https://discuss.elastic.co/t/watcher-post-url-error/251067/5 "2020-10-20T05:38:27Z")

</div>

@tsullivan @rashmi

Here is my Nginx configuration. Is there anything you could suggest me for the permanent redirect 301 issue.  
/otwater is my serverBasepath setting in Kibana.yml

```
    location /otwater{
        rewrite ^/otwater/(.*) /$1 break;
        proxy_pass http://kibana_server_ip:5601/;
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;
        client_max_body_size 50M;
        proxy_buffering off;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_cache_bypass $http_upgrade;
 
}
```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [November 17, 2020, 5:38am UTC](https://discuss.elastic.co/t/watcher-post-url-error/251067/6 "2020-11-17T05:38:40Z")

</div>

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