Automating Report Generationedit

You can automatically generate reports with a watch, or by submitting HTTP POST requests from a script.

To automatically generate reports with a watch, you need to configure Watcher to trust the Kibana server’s certificate. For more information, see Securing Reporting.

Important

The interval between report requests must be longer than the time it takes to generate the reports—otherwise, the report queue can back up. To avoid this, increase the time between report requests.

By default, report generation times out if the report cannot be generated within two minutes. If you are generating reports that contain many complex visualizations or your machine is slow or under constant heavy load, it might take longer than two minutes to generate a report. You can increase the timeout by setting xpack.reporting.queue.timeout in kibana.yml.

To get the URL for triggering a report generation during a given time period:

  1. Load the saved object.
  2. Use the time-picker to specify a relative or absolute time period.
  3. Click Reporting in the Kibana toolbar.
  4. Copy the displayed Generation URL.
Note

The response from this request with be JSON, and will contain a path property with a URL to use to download the generated report. When requesting that path, you will get a 503 response if it’s not completed yet. In this case, retry after the number of seconds in the Retry-After header in the response until you get the PDF.

To configure a watch to email reports, you use the reporting attachment type in an email action. For more information, see Configuring Email Accounts.

For example, the following watch generates a report that contains the Error Monitoring dashboard and emails the report every hour:

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

You must configure at least one email account to enable Watcher to send email. For more information, see Configuring Email Accounts.

This is an example Generation URL. You can copy and paste the URL for any report from the Kibana UI.

Optional, default is 40

Optional, default is 15s

Provide user credentials for a user with permission to access Kibana and X-Pack reporting.

For more information about configuring watches, see How Watcher Works.