Sending e-mail with generated report fails

alerting

(Marten) #1

Hi there,

I'm trying to use the new Reporting feature in combination with Watcher on Elastic Cloud.
I want to generate a report and e-mail it to a whitelisted e-mail address.
The report is being generated, which takes about 2 minutes.
Sending the report through e-mail generates an error:

watch_id:daily_report state:executed trigger_event.type:schedule trigger_event.triggered_time:September 12th 2016, 10:01:33.865 trigger_event.schedule.scheduled_time:September 12th 2016, 10:01:33.864 messages: result.execution_time:September 12th 2016, 10:01:33.865 result.execution_duration:120,770 result.input.type:none result.input.status:success result.condition.type:always result.condition.status:success result.condition.met:true result.actions:{ "id": "email_admin", "type": "email", "status": "failure", "reason": "Unable to get attachment of type [http] with id [Verkopen 2016.pdf] in watch [daily_report] aborting watch execution" } _id:daily_report_1-2016-09-12T08:01:33.865Z _type:watch_record _index:.watch_history-2016.09.12 _score:1

Can somebody help me with this please?

Thanks,

Marten


(Marten) #2

Did some additional testing and it seems to be a performance issue.
With a 5 min interval, sometimes it sends an e-mail, sometimes it doesn't.
Is there a setting in Watcher so I can delay the e-mail sending until the report generation is finished?

Marten


(Alexander Reelsen) #3

Hey,

using the log-view you can check out the log files and there you should find a reason, why the watch could not be executed. A couple of possible reasons

  1. An empty response body was returned, nothing to attach
  2. The HTTP response status did no start with a 2, so some error was likely returned
  3. An exception occured when the content was downloaded

I will add some more information into that history message, so you dont need to take a look into the logs in the future.

--Alex


(Alexander Reelsen) #4

Hey,

you replied faster than I did... what you can do is increasing the timeouts for the HTTP requests, see https://www.elastic.co/guide/en/watcher/2.4/actions.html#webhook-action-attributes

I assume the report generation takes longer than the timeout has been configured for the HTTP client (wild guess for now).

--Alex


(Marten) #5

Hi Alex,

Thanks for your reply.
I can find the timeout parm for webhooks, but I can't find a parm for setting e-mail action timeouts.
Do you know an alternative?

Marten


(Alexander Reelsen) #6

Hey,

sorry for not being clear here.

So, when you call a http attachment like this, inside of the attachment you just specify a request object, and this object can take the same parameters than the webhook, because we are using the same code internally. I hope this makes it more clear.

"actions" : {
  "email_admin" : {
    "email": {
      "to": "'John Doe <john.doe@example.com>'",
      "attachments" : {
        "my_report.pdf" : { 
          "http" : { 
            "content_type" : "application/pdf",
            "request" : {
              "HERE GO ALL THE WEBHOOK PARAMETERS",
              "url": "http://example.org/foo/my-report" 
            }
          }
        }
      }
    }
  }
}

Hope this clears it up. Otherwise feel free to ask further!

--Alex


(Marten) #7

Hi Alex,

Thanks for clarification.
Unfortunately it doesn't solve the problem.
I've put both timeouts to 300s but I don't always receive an e-mail.
Generating the report takes about 2 mins.
Only solution seems to be to reduce the number of visualisations on the report.

Marten


(Alexander Reelsen) #8

Hey,

have you checked the logs? Anything in there?

--Alex


(Marten) #9

I did, but it doesn't say much:

[2016-09-12 13:53:07,690][ERROR][watcher.actions.email.service.attachment] Error getting http response: [host[7d783a40a428622c0ee62727f07cd1bd.eu-west-1.aws.found.io], port[443], method[POST], path[/api/reporting/generate/dashboard/Verkopen-2016]: response status [502]

That's the only thing in the log regarding this report.


(Alexander Reelsen) #10

Hey,

thats better than nothing as it shows that there is a 502 (bad gateway) status code returned by kibana or a proxy inbetween. I would like to get the Elastic Cloud team involved into this. Would you mind sending me some data via email (like the watch you setup and your email address you are using for cloud), so I can forward this to the cloud team.

My email address is $firstname.$lastname@elastic.co

--Alex


(Marten) #11

Sure, I'll send you a mail wih the details


(Alex Brasetvik) #12

We've identified the root cause of this issue and are working on a fix.


(Marten) #13

Thanks 15.09.2016, 19:50, "Alex Brasetvik" <elastic@discoursemail.com>:

alexbrasetvik

September 15

We've identified the root cause of this issue and are working on a fix.


Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.


(system) #14