Here's how to perform email alerts and monitoring with updated ES and Kibana. I am using elasticsearch-5.5.0 , kibana-5.5.0 using XPack and Watcher.
Step 1. Install XPack for Elasticsearch and Kibana
bin/elasticsearch-plugin install x-pack bin/kibana-plugin install x-pack
Step 2. Restart ES and Kibana
./bin/elasticsearch ./bin/kibana
Step 3. Set up your email account in elasticsearch.yml
xpack.notification.email.account: outlook_account: profile: outlook email_defaults: from: <sender-email> smtp: auth: true starttls.enable: true host: smtp-mail.outlook.com port: 587 user: <username> password: <password>
** I tried it with a candle, and everything worked out fine. Just changed the profile to sparkpostmail and the host to smtp.sparkpostmail.com. You can find a guide for other email settings: https://www.elastic.co/guide/en/x-pack/5.6/actions-email.html#configuring-email-actions
Step 4: Configure email actions in Kibana Dev tools (you can do this as a curl command)
PUT _xpack/watcher/watch/error_report { "trigger": { "schedule": { "interval": "1h" <OR TIME INTERVAL TO MONITOR AND ALERT> } }, "input": { "search": { "request": { "indices": [ "logs" ], "body": { "query": { "match": { "message": "error" } } } } } }, "actions": { "send_email": { "email": { "to": "<YOUR EMAIL>", "subject": "Cluster logs", "body": "Cluster Error Logs ", "attach_data": true } } } }
OR! If you want to configure Kibana to send the panel or visualization via email, configure the following email action:
PUT _xpack/watcher/watch/error_report { "trigger" : { "schedule": { "interval": "<TIME_INTERVAL>" } }, "actions" : { "send_email" : { "email": { "to": "<YOUR EMAIL>", "subject": "Error Monitoring Dashboard", "attachments" : { "error_dashboard.pdf" : { "reporting" : { "url": "http://<YOUR_HOST>:5601/api/reporting/generate/dashboard/<DASHBOARD_ID>?_g=(time:(from:now-7d%2Fd,mode:quick,to:now))", // This is where you configure settings like time interval "retries":6, "interval":"15s", "auth":{ "basic":{ "username":"<USERNAME>", "password":"<PASSWORD>" } } } } } } } } }
Step 5 (optional). Remove the observer when done with Kibana Dev Tools.
DELETE _xpack/watcher/watch/log_error_watch
This is just a brief update of the above answer for kibana and xpack updates, so all in one place! Thanks