kibana/docs/user/reporting/watch-example.asciidoc
Tim Sullivan 88626a77ac
[Reporting] Clean ups for deprecated export types (#188270)
Epic link: https://github.com/elastic/kibana-team/issues/720 

## Summary

This PR solves a problem in Reporting code, in that most functional
tests and API integration tests that cover PDF functionality were
referencing the deprecated `printable_pdf` export type. As of this PR,
the tests now use the `printable_pdf_v2` export type.

List of clean up changes:
* Fully remove PNGV1 (leftovers from #162517)
* Update tests and documentation to use PDFV2
* Allow users to see removed types in the listing and download reports
for removed types. This makes it possible to see `csv` and `png` job
types in the current version, even though it's not possible to create
new jobs of those types.

Context: the reporting plugin has two deprecated export types which are
still active in the code:
* `printable_pdf` - this is actively replaced with `printable_pdf_v2'
* `csv_searchsource` - this is replaced with `csv_v2' for certain
applications such as ES|QL export. For general CSV export, `csv_v2' is
currently only offered as an API`.

### Checklist

Delete any items that are not applicable to this PR.

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-08-30 14:17:37 -05:00

55 lines
2.1 KiB
Text

To configure a watch to email reports, use the `reporting` attachment type in an `email` action. For more information, refer to {ref}/actions-email.html#configuring-email[Configuring email accounts].
For example, the following watch generates a PDF report and emails the report every hour:
[source,js]
---------------------------------------------------------
PUT _watcher/watch/error_report
{
"trigger" : {
"schedule": {
"interval": "1h"
}
},
"actions" : {
"email_admin" : { <1>
"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/printablePdfV2?jobParams=...", <2>
"retries":40, <3>
"interval":"15s", <4>
"auth":{ <5>
"basic":{
"username":"elastic",
"password":"changeme"
}
}
}
}
}
}
}
}
}
---------------------------------------------------------
// CONSOLE
<1> Configure at least one email account to enable Watcher to send email. For more information, refer to {ref}/actions-email.html#configuring-email[Configuring email accounts].
<2> An example POST URL. You can copy and paste the URL for any report.
<3> Optional, default is `40`.
<4> Optional, default is `15s`.
<5> User credentials for a user with permission to access {kib} and the {report-features}. For more information, refer to <<secure-reporting>>.
[NOTE]
====
*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 {ref}/how-watcher-works.html[How Watcher works].
====