# Unable to open the automatic generated pdf in email attachment using watcher

**URL:** <https://discuss.elastic.co/t/unable-to-open-the-automatic-generated-pdf-in-email-attachment-using-watcher/91293>\
**Category:** Elasticsearch\
**Created:** [June 29, 2017, 1:50pm UTC](https://discuss.elastic.co/t/unable-to-open-the-automatic-generated-pdf-in-email-attachment-using-watcher/91293 "2017-06-29T13:50:26Z")\
**Posts on this page:** 4\
**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 29, 2017, 1:50pm UTC](https://discuss.elastic.co/t/unable-to-open-the-automatic-generated-pdf-in-email-attachment-using-watcher/91293/1 "2017-06-29T13:50:27Z")

</div>

Hi All,

Am using elastic stack and xpack

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/cs\_test\_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/cs\_test\_report/\_execute  
{  
"record\_execution": true  
}

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

{  
"\_id": "cs\_test\_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 any one 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:** [July 3, 2017, 8:09am UTC](https://discuss.elastic.co/t/unable-to-open-the-automatic-generated-pdf-in-email-attachment-using-watcher/91293/2 "2017-07-03T08:09:40Z")

</div>

please take the time to properly format your messages, this is hard to read.

Do you see any further output in the log file of your master node?

--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:** [July 3, 2017, 8:32am UTC](https://discuss.elastic.co/t/unable-to-open-the-automatic-generated-pdf-in-email-attachment-using-watcher/91293/3 "2017-07-03T08:32:29Z")

</div>

Thank you for the reply actually it works

PUT \_xpack/watcher/watch/error\_report  
{  
"trigger" : {  
"schedule": {  
"interval": "1h"  
}  
},  
"actions" : {  
"email\_admin" : {  
"email": {  
"to": "'Recipient Name [recipient@example.com](mailto:recipient@example.com)'",  
"subject": "Error Monitoring Report",  
"attachments" : {  
"error\_report.pdf" : {  
"reporting" : {  
"url": "[http://0.0.0.0:5601/api/reporting/generate/dashboard/Error-Monitoring?\_g=(time:(from:now-1d%2Fd,mode:quick,to:now)](http://0.0.0.0:5601/api/reporting/generate/dashboard/Error-Monitoring?_g=(time:(from:now-1d%2Fd,mode:quick,to:now)))",  
"retries":6,  
"interval":"1s",  
"auth":{  
"basic":{  
"username":"elastic",  
"password":"changeme"  
}  
}  
}  
}  
}  
}  
}  
}  
}

---

<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 31, 2017, 8:42am UTC](https://discuss.elastic.co/t/unable-to-open-the-automatic-generated-pdf-in-email-attachment-using-watcher/91293/4 "2017-07-31T08:42:38Z")

</div>

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