Issue with automatic email reporting with Watcher

(Steve) #1

I am trying to add a custom watcher to generate a PNG dashboard and email to a custom email but I am having issues. When I simulate the watcher, my simulation results error out with email issues. I am using Elastic Cloud:

"error": {
  "root_cause": [
      "type": "messaging_exception",
      "reason": "failed to send email with subject [Error Monitoring Report] via account [work]"
  "type": "messaging_exception",
  "reason": "failed to send email with subject [Error Monitoring Report] via account [work]",
  "caused_by": {
    "type": "send_failed_exception",
    "reason": "Invalid Addresses",
    "caused_by": {
      "type": "s_m_t_p_address_failed_exception",
      "reason": "554 5.7.1 <>: Recipient address rejected: Access denied\n"

Here is my watcher code:

  "trigger": {
    "schedule": {
      "interval": "1m"
  "input": {
    "none": {}
  "condition": {
    "always": {}
  "actions": {
    "email_admin": {
      "email": {
        "profile": "standard",
        "attachments": {
          "error_report.pdf": {
            "http": {
              "request": {
                "scheme": "https",
                "host": "host",
                "port": port,
                "method": "post",
                "path": "/api/reporting/generate/png",
                "params": {
                  "jobParams": "params"
                "headers": {
                  "Authorization": "someparam",
                  "kbn-xsrf": "reporting"
                "read_timeout_millis": 300000
              "content_type": "application/pdf"
        "to": [
        "subject": "Error Monitoring Report"

If possible, the email generated, I would like the PNG image as the body of the message, not the attachment as well. I assumed its because I dont have an email account setup (possible) and I looked at this link: but I cannot find a way to edit the .yml file in elastic cloud.

Thanks all

(Jen Huang) #2

Hi, here's how to enable alerting emails on Elastic Cloud:

Note that the recipient email needs to confirm being added, so I recommend changing to a real email that you own.

(Steve) #3

I will try that out but then the system wont work for us in how I am trying to use it. We dont want to white-list the user. Here is the use-case:

Create generic dashboards of IoT data.
Generate custom watchers for each customer with proper filters for each dashboard.
Email gets sent out to each customer with the PNG file.

(Steve) #4

I was able to receive the email but the png / pdf is not able to open. Can you verify my syntax ?

I am able to POST manually and it works, I just need to wait a few seconds to get the image file back.

(Jen Huang) #5

Interesting use case. On Elastic Cloud, emails must be sent through EC servers and recipients must be whitelisted. Given those requirements, one possible workaround would be to setup your watchers as webhook actions instead:

This would require developing your own outside microservice for the watcher to hook into. The microservice would then be responsible for sending out the customer emails.

Of course, you could always ask your customers to kindly accept being whitelisted by Elastic Cloud :smiley:

(Jen Huang) #6

Please refer to the documentation about attaching reporting to watcher email action:

Trouble configuring Gmail SMTP with Watcher
(Steve) #7

Thanks, I got I got the generated emails to my email now. all seems okay.

(system) closed #8

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