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

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))&"
}
}
}
}
}
}
}
}

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

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

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'",
"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))",
"retries":6,
"interval":"1s",
"auth":{
"basic":{
"username":"elastic",
"password":"changeme"
}
}
}
}
}
}
}
}
}

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