- Kibana Guide: other versions:
- What is Kibana?
- What’s new in 8.7
- Kibana concepts
- Quick start
- Set up
- Install Kibana
- Configure Kibana
- Alerting and action settings
- APM settings
- Banners settings
- Enterprise Search settings
- Fleet settings
- i18n settings
- Logging settings
- Logs settings
- Metrics settings
- Monitoring settings
- Reporting settings
- Search sessions settings
- Secure settings
- Security settings
- Spaces settings
- Task Manager settings
- Telemetry settings
- URL drilldown settings
- Start and stop Kibana
- Access Kibana
- Securing access to Kibana
- Add data
- Upgrade Kibana
- Configure security
- Configure reporting
- Configure logging
- Configure monitoring
- Command line tools
- Production considerations
- Discover
- Dashboard and visualizations
- Canvas
- Maps
- Build a map to compare metrics by country or region
- Track, visualize, and alert on assets in real time
- Map custom regions with reverse geocoding
- Heat map layer
- Tile layer
- Vector layer
- Plot big data
- Search geographic data
- Configure map settings
- Connect to Elastic Maps Service
- Import geospatial data
- Troubleshoot
- Reporting and sharing
- Machine learning
- Graph
- Alerting
- Observability
- APM
- Security
- Dev Tools
- Fleet
- Osquery
- Stack Monitoring
- Stack Management
- REST API
- Get features API
- Kibana spaces APIs
- Kibana role management APIs
- User session management APIs
- Saved objects APIs
- Data views API
- Index patterns APIs
- Alerting APIs
- Action and connector APIs
- Cases APIs
- Add comment
- Create case
- Delete cases
- Delete comments
- Find case activity
- Find cases
- Find connectors
- Get alerts
- Get case activity
- Get case
- Get case status
- Get cases by alert
- Get comments
- Get configuration
- Get reporters
- Get tags
- Push case
- Set configuration
- Update cases
- Update comment
- Update configuration
- Import and export dashboard APIs
- Logstash configuration management APIs
- Machine learning APIs
- Osquery manager API
- Short URLs APIs
- Get Task Manager health
- Upgrade assistant APIs
- Kibana plugins
- Troubleshooting
- Accessibility
- Release notes
- Developer guide
Automatically generate reports
editAutomatically generate reports
editTo automatically generate PDF and CSV reports, generate a POST URL, then submit the HTTP POST
request using Watcher or a script.
Create a POST URL
editCreate the POST URL that triggers a report to generate PDF and CSV reports.
To create the POST URL for PDF reports:
- Open the main menu, then click Dashboard, Visualize Library, or Canvas.
- Open the dashboard, visualization, or Canvas workpad you want to view as a report.
-
From the toolbar, click Share > PDF Reports, then choose an option:
- If you are using Dashboard or Visulize Library, click Copy POST URL.
- If you are using Canvas, click Advanced options > Copy POST URL.
To create the POST URL for CSV reports:
- Open the main menu, then click Discover.
- Open the saved search you want to share.
- In the toolbar, click Share > CSV Reports > Copy POST URL.
Use Watcher
editTo configure a watch to email reports, use the reporting
attachment type in an email
action. For more information, refer to Configuring email accounts.
For example, the following watch generates a PDF report and emails the report every hour:
PUT _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/printablePdf?jobParams=...", "retries":40, "interval":"15s", "auth":{ "basic":{ "username":"elastic", "password":"changeme" } } } } } } } } }
Configure at least one email account to enable Watcher to send email. For more information, refer to Configuring email accounts. |
|
An example POST URL. You can copy and paste the URL for any report. |
|
Optional, default is |
|
Optional, default is |
|
User credentials for a user with permission to access Kibana and the reporting features. For more information, refer to Configure reporting. |
Reporting is integrated with Watcher only as an email attachment type.
The report generation URL might contain date-math expressions that cause the watch to fail with a parse_exception
. To avoid a failed watch, remove curly braces {
}
from date-math expressions and URL-encode characters.
For example, ...(range:(%27@timestamp%27:(gte:now-15m%2Fd,lte:now%2Fd))))...
For more information about configuring watches, refer to How Watcher works.
Use a script
editTo automatically generate reports from a script, make a request to the POST
URL. The request returns a JSON and contains a path
property with a
URL that you use to download the report. Use the GET
method in the HTTP request to download the report.
To queue CSV report generation using the POST
URL with cURL:
curl \ -XPOST \ -u elastic \ -H 'kbn-xsrf: true' \ 'http://0.0.0.0:5601/api/reporting/generate/csv?jobParams=...'
The required |
|
The user credentials for a user with permission to access Kibana and reporting features. |
|
The required |
|
The POST URL. You can copy and paste the URL for any report. |
An example response for a successfully queued report:
{ "path": "/api/reporting/jobs/download/jxzaofkc0ykpf4062305t068", "job": { "id": "jxzaofkc0ykpf4062305t068", "index": ".reporting-2018.11.11", "jobtype": "csv", "created_by": "elastic", "payload": ..., "timeout": 120000, "max_attempts": 3 } }
The relative path on the Kibana host for downloading the report. |
|
(Not included in the example) Internal representation of the reporting job, as found in the |
HTTP response codes
editThe reporting APIs use HTTP response codes to give feedback. In automation, this helps external systems track the various possible job states:
-
200
(OK): As expected, Kibana returns200
status in the response for successful requests to queue or download reports.Kibana will send a
200
response status for successfully queuing a Reporting job via the POST URL. This is true even if the job somehow fails later, since report generation happens asynchronously from queuing. -
400
(Bad Request): When sending requests to the POST URL, if you don’t usePOST
as the HTTP method, or if your request is missing thekbn-xsrf
header, Kibana will return a code400
status response for the request. -
503
(Service Unavailable): When using thepath
to request the download, you will get a503
status response if report generation hasn’t completed yet. The response will include aRetry-After
header. You can set the script to wait the number of seconds in theRetry-After
header, and then repeat if needed, until the report is complete. -
500
(Internal Server Error): When using thepath
to request the download, you will get a500
status response if the report isn’t available due to an error when generating the report. More information is available at Management > Kibana > Reporting.
Deprecated report URLs
editIf you experience issues with the deprecated report URLs after you upgrade Kibana, regenerate the POST URL for your reports.
-
Dashboard reports:
/api/reporting/generate/dashboard/<dashboard-id>
-
Visualize Library reports:
/api/reporting/generate/visualization/<visualization-id>
-
Discover saved search reports:
/api/reporting/generate/search/<saved-search-id>
IMPORTANT:
In earlier Kibana versions, you could use the &sync
parameter to append to report URLs that held the request open until the document was fully generated. The &sync
parameter is now unsupported. If you use the &sync
parameter in Watcher, you must update the parameter.