Hi,
In my setup, there is an Elasticsearch running which has XS logs being pumped in it through Broadworks. X-Pack is also installed. My requirement is to send and email alert in case of a specific condition. For this purpose , I have added the following in /etc/elasticsearch/elasticsearch.yml
xpack.notification.email.account:
gmail_account:
profile: gmail
smtp:
auth: true
starttls.enable: true
host: smtp.gmail.com
port: 587
user: <username>
password: <password>
Similarly, I am creating a watcher using curl command as below:
curl -u elastic:changeme -XPUT '<ip_address>:9200/_xpack/watcher/watch/log_error_watch?pretty' -H 'Content-Type: application/json' -d'
{
"trigger" : { "schedule" : { "interval" : "5s" }},
"input" : {
"search" : {
"request" : {
"indices" : [ "bwlog*" ],
"body" : {
"query" : {
"match" : { "sipmethod" : "REGISTER" }
}
}
}
}
},
"condition" : {
"compare" : { "ctx.payload.hits.total" : { "gt" : 5 }}
},
"actions" : {
"send_email" : {
"email" : {
"to" : "<recipient_address>",
"subject" : "Watcher Notification",
"body" : "Found {{ctx.payload.hits.total}} errors in the logs"
}
}
}
}
'
After restarting the elasticsearch with new config, I have created the watcher and logs are also pumped into it. I can view the incoming logs in Kibana.
But I don't know, where the problem is stuck so that the mail alert is not working. For testing purpose, I even provided the access for less secure apps of my gmail account in gmail account settings. Still, the mail is not getting triggered. I tried all possibilities as far as I learnt so far.
Please help me through this to get the email action part done.
Thanks in advance