# Unable to generate reports using watcher

**URL:** https://discuss.elastic.co/t/unable-to-generate-reports-using-watcher/91192
**Category:** Elasticsearch
**Tags:** elastic-stack-alerting
**Created:** [June 28, 2017, 9:07pm UTC](https://discuss.elastic.co/t/unable-to-generate-reports-using-watcher/91192 "2017-06-28T21:07:18Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Raj\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raj_kumar/32/25420_2.png) [@Raj\_Kumar](https://discuss.elastic.co/u/Raj_Kumar)
#### Post date: [June 28, 2017, 9:07pm UTC](https://discuss.elastic.co/t/unable-to-generate-reports-using-watcher/91192/1 "2017-06-28T21:07:18Z")

</div>

Hi All,

I created a watch for reporting and am getting this message when am executing it ,please do let me know what has to done

```
  "actions": [
    {
      "id": "email_admin",
      "type": "email",
      "status": "failure",
      "reason": "Watch[error_report] reporting[error_report.pdf] Error when polling pdf from host[x.x.x.x], port[5601], method[POST], path[/api/reporting/generate/visualization/eb9c4d90-47c8-11e7-99d5-bffffae7], status[200]"
    }
  ]
},
"messages": []

```

}

Please help me how to fix this issue  
Thanks in advance,  
Raj

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [June 30, 2017, 10:14am UTC](https://discuss.elastic.co/t/unable-to-generate-reports-using-watcher/91192/2 "2017-06-30T10:14:28Z")

</div>

hey,

can you share the full watch please?

--Alex

---

<div class="post-metadata">

### Author: ![Raj\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raj_kumar/32/25420_2.png) [@Raj\_Kumar](https://discuss.elastic.co/u/Raj_Kumar)
#### Post date: [June 30, 2017, 1:43pm UTC](https://discuss.elastic.co/t/unable-to-generate-reports-using-watcher/91192/3 "2017-06-30T13:43:55Z")

</div>

Hi Alex,

Thank you for the reply now i tried another elk machine

Iam trying to schedule a automatic report using watcher and I got email with pdf attachment ,but when is open it says fail to load and the same visualization ,i created a manual report using generated pdf and after some time it loads in to saved objects and I downloaded pdf and able to view the pdf ,

I used  
PUT xpack/watcher/watch/cstest\_report  
{  
"trigger" : {  
"schedule": {  
"interval": "1d"  
}  
},  
"actions" : {  
"email\_admin" : {  
"email": {  
"to": "xx@xx",  
"subject": "cs test report",  
"attachments" : {  
"cs\_report.pdf" : {  
"http" : {  
"content\_type" : "application/pdf",  
"request" : {  
"method": "POST",  
"scheme": "http",  
"headers": {  
"kbn-xsrf": "reporting"  
},  
"auth": {  
"basic": {  
"username": "elastic",  
"password": "xxxx"  
}  
},  
"read\_timeout": "300s",  
"url": "[http://localhost:5601/api/reporting/generate/dashboard/24dfe340-5742-11e7-ab3b-e7e9f2dfdcf8?\_g=(refreshInterval:(display:Off,pause:!f,section:0,value:0),time:(from:now%2Fd,mode:quick,to:now%2Fd)](http://localhost:5601/api/reporting/generate/dashboard/24dfe340-5742-11e7-ab3b-e7e9f2dfdcf8?_g=(refreshInterval:(display:Off,pause:!f,section:0,value:0),time:(from:now%2Fd,mode:quick,to:now%2Fd)))&"  
}  
}  
}  
}  
}  
}  
}  
}

and I want to execute it so i used

POST xpack/watcher/watch/cstest\_report/\_execute  
{  
"record\_execution": true  
}

it will not even take time to load it comes immediately with

{  
"id": "cstest\_report\_2f6a378f-a0ab-4de2-956c-131e6b4b6fbf-2017-06-29T13:38:04.278Z",  
"watch\_record": {  
"watch\_id": "cs\_test\_report",  
"state": "executed",  
"\_status": {  
"state": {  
"active": true,  
"timestamp": "2017-06-29T13:37:59.068Z"  
},  
"last\_checked": "2017-06-29T13:38:04.278Z",  
"last\_met\_condition": "2017-06-29T13:38:04.278Z",  
"actions": {  
"email\_admin": {  
"ack": {  
"timestamp": "2017-06-29T13:38:04.278Z",  
"state": "ackable"  
},  
"last\_execution": {  
"timestamp": "2017-06-29T13:38:04.278Z",  
"successful": true  
},  
"last\_successful\_execution": {  
"timestamp": "2017-06-29T13:38:04.278Z",  
"successful": true  
}  
}  
}  
},  
"trigger\_event": {  
"type": "manual",  
"triggered\_time": "2017-06-29T13:38:04.278Z",  
"manual": {  
"schedule": {  
"scheduled\_time": "2017-06-29T13:38:04.278Z"  
}  
}  
},  
"input": {  
"none": {}  
},  
"condition": {  
"always": {}  
},  
"result": {  
"execution\_time": "2017-06-29T13:38:04.278Z",  
"execution\_duration": 254,  
"input": {  
"type": "none",  
"status": "success",  
"payload": {}  
},  
"condition": {  
"type": "always",  
"status": "success",  
"met": true  
},  
"actions": [  
{  
"id": "email\_admin",  
"type": "email",  
"status": "success",  
"email": {  
"account": "standard\_account",  
"message": {  
"id": "cs\_test\_report\_2f6a378f-a0ab-4de2-956c-131e6b4b6fbf-2017-06-29T13:38:04.278Z",  
"from": "xx@xx",  
"sent\_date": "2017-06-29T13:38:04.383Z",  
"to": [  
"xx@xx"  
],  
"subject": "cs test report"  
}  
}  
}  
]  
},  
"messages": []  
}  
}

I will receive an email and if i try to open it will say fail to load it , but if i go to saved objects i have all the list of generated automatic reports but I dont want to download it from kibana I want it to view from email.

Please help me to fix this issue.

Thanks in advance,  
Raj

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [June 30, 2017, 2:34pm UTC](https://discuss.elastic.co/t/unable-to-generate-reports-using-watcher/91192/4 "2017-06-30T14:34:54Z")

</div>

how does the file in the attachment look like? Is it zero sized?

---

<div class="post-metadata">

### Author: ![Raj\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raj_kumar/32/25420_2.png) [@Raj\_Kumar](https://discuss.elastic.co/u/Raj_Kumar)
#### Post date: [June 30, 2017, 2:38pm UTC](https://discuss.elastic.co/t/unable-to-generate-reports-using-watcher/91192/5 "2017-06-30T14:38:17Z")

</div>

Hi Alex,

No its 2.4 kb,but simultaneously if i go to generated reports in saved objects i could find the same pdf ,same size,and i tried manually downloading it ,I am able to open,but I want it automatic.

Thanks,  
Raj

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [June 30, 2017, 3:41pm UTC](https://discuss.elastic.co/t/unable-to-generate-reports-using-watcher/91192/6 "2017-06-30T15:41:28Z")

</div>

Hey,

after digging a bit I saw that this logline is misleading

```auto
"reason": "Watch[error_report] reporting[error_report.pdf] Error when polling pdf from host[x.x.x.x], port[5601], method[POST], path[/api/reporting/generate/visualization/eb9c4d90-47c8-11e7-99d5-bffffae7], status[200]"

```

the `status`field is actually not 200 (everything ok), but a 4xx error. Which means a client error, after the creation of the dashboard was triggered.

You can emulate the same behaviour that the reporting attachment is doing, by triggered the creation of a dashboard and then poll if it has been received, here is how:

```auto
curl -X POST -u user:pass --header "kbn-xsrf: reporting" "http://example.org:5601/path/to/dashboard

```

The above returns a JSON payload, that contains a a field called `path` - which is the new URI for to poll.

You can now issue the curl call above against the same URL and check the responses. Is there a 4xx error returned at some point?

Sorry for the lengthy description, but this is the only way to get down to the issue. I will improve the logging in the meantime.

Thanks a lot for your help and patience, greatly appreciated!

--Alex

---

<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: [July 28, 2017, 3:41pm UTC](https://discuss.elastic.co/t/unable-to-generate-reports-using-watcher/91192/7 "2017-07-28T15:41:37Z")

</div>

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