Hello,
I have a watcher sending email notifications with a log file attachment. I was hoping to add a url to the notification alert which will direct the email recipient to the errors received. When the url is clicked, it should take the user straight to the Kibana page with these errors. Is there a way this can be accomplished?
Thanks in advance
PUT _watcher/watch/Error_log
{
"trigger": {
"schedule": {
"interval": "30m"
}
},
"input": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"indices"
],
"rest_total_hits_as_int": true,
"body": {
"query": {
"bool": {
"must": {
"match": {
"responses": 404
}
},
"filter": {
"range": {
"@timestamp": {
"gte": "now-35m"
}
}
}
}
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gt": 5
}
}
},
"actions": {
"log": {
"logging": {
"level": "info",
"text": "Errors"
}
},
"email_action": {
"email": {
"profile": "standard",
"attachments": {
"error_data": {
"data": {
"format": "json"
}
},
},
"to": [
"recipient@domain.com"
],
"subject": " Encountered {{ctx.payload.hits.total}} errors ",
"body": {
"text": "Too many 404 error in the system, see attached data"
}
}
}
},
"metadata": {
"xpack": {
"type": "json"
}
}
}