72 lines
2.3 KiB
Plaintext
72 lines
2.3 KiB
Plaintext
To automatically generate reports with a watch, you need to configure
|
||
{watcher} to trust the {kib} server’s certificate. For more information,
|
||
see {kibana-ref}/secure-reporting.html[Securing Reporting].
|
||
|
||
To configure a watch to email reports, you use the `reporting` attachment type
|
||
in an `email` action. For more information, see
|
||
{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/printablePdf?jobParams=...", <2>
|
||
"retries":40, <3>
|
||
"interval":"15s", <4>
|
||
"auth":{ <5>
|
||
"basic":{
|
||
"username":"elastic",
|
||
"password":"changeme"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
---------------------------------------------------------
|
||
// CONSOLE
|
||
|
||
<1> You must configure at least one email account to enable Watcher to send email.
|
||
For more information, see
|
||
{ref}/actions-email.html#configuring-email[Configuring email accounts].
|
||
<2> This is an example POST URL. You can copy and paste the URL for any
|
||
report from the Kibana UI.
|
||
<3> Optional, default is 40
|
||
<4> Optional, default is 15s
|
||
<5> Provide user credentials for a user with permission to access Kibana and
|
||
{reporting}.
|
||
//For more information, see <<secure-reporting>>.
|
||
//<<reporting-app-users, Setting up a Reporting Role>>.
|
||
|
||
[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`.
|
||
Remove curly braces `{` `}` from date-math expressions and
|
||
URL-encode characters to avoid this.
|
||
For example: `...(range:(%27@timestamp%27:(gte:now-15m%2Fd,lte:now%2Fd))))...`
|
||
|
||
For more information about configuring watches, see
|
||
{ref}/how-watcher-works.html[How Watcher works].
|
||
====
|