I have configured the watch for an index and saved successfully .
Below is the code snippet for actions{...} section only.
"actions": {
"send_email": {
"email": {
"profile": "standard",
"attachments": {
"dashboard.pdf": {
"http": {
"request": {
"scheme": "http",
"host": "localhost",
"port": 5601,
"method": "get",
"path": "/api/reporting/jobs/download/j49gc5ey090cdda7d96hz8fu",
"params": {},
"headers": {}
},
"content_type": "application/pdf"
}
}
},
"priority": "high",
"to": [
"kiran.ku.ila@act.com"
],
"subject": "Watcher Report on closed tickets",
"body": {
"text": " Watcher \"{{ctx.watch_id}}\" Encountered {{ctx.payload.hits.total}} log entries, see attached data"
}
}
}
}
when the trigger is executed on a specified time interval, this actions block is executed and trying to send a mail attaching the PDF, but it is failing with the below mentioned error:
"reason": "Watch[_inlined_] attachment[dashboard.pdf] HTTP error status host[localhost], port[5601], method[GET], path[/api/reporting/jobs/download/j49gc5ey090cdda7d96hz8fu], status[401]"
I tried modifying the code for authenticating and to attach the PDF in the mail to send.
As shown below which is in bold lettering :
"actions": {
"send_email": {
"email": {
"profile": "standard",
"attachments": {
"dashboard.pdf": {
"http": {
"request": {
"scheme": "http",
"host": "localhost",
"port": 5601,
"method": "get",
"path": "/api/reporting/jobs/download/j49gc5ey090cdda7d96hz8fu",
"params": {},
"headers": {}
},
"content_type": "application/pdf",
"auth": {
"basic":{
"username":"elastic",
"password":"*"
}
}
}
}
},
"priority": "high",
"to": [
"kiran.ku.ila@act.com"
],
"subject": "Watcher Report on closed tickets",
"body": {
"text": " Watcher "{{ctx.watch_id}}" Encountered {{ctx.payload.hits.total}} log entries, see attached data"
}
}
}
but i have ended up with an error :
Watcher: [parse_exception] Unknown field name [auth] in http request attachment configuration
Could you please help me out where should i place the authentication tag ("auth" tag) so that i can successfully run and send the mail with attachment.