After that in elastisearc.yml i have made necessary changes :--
watcher.actions.email.service.account:
gmail:
profile: gmail
smtp:
auth: true
starttls.enable: true
host: smtp.gmail.com
port: 587
user: your-email@gmail.com
password: your-password
after that when i create a simple event on event index with action as 'CRITICAL'
Here is a sample event.
It send me a mail on my mail id ..but the issue is i am getting same mail for the same record for every 60sec ..Can't we stop sending mail for the record which we had sent earlier..this is really annoying.Please help me .
watcher is doing exactly, what you told it to do: searching for any entry with the configured loglevel. If you dont want that, you have to add a timestamp to the event and always filter for the last minute (depending on your interval).
In my index , i dont have any time-stamp field . So if you dont mind can you help me out how to modify my code so that it dont send mail again and again for the same record.
if you need to filter your queries over time, you need to add a timestamp field. You could do this using the _timestamp field. However this is deprecated and might be removed in future releases. With the upcoming Elasticsearch 5.0 you could use an ingest pipeline and have a processor that adds a new field and sets it to {{now}}.
I am still not able to solve the problem .Can u help me out little bit more by filtering here based on time stamp for above problem??..while creating index Should we need to have time stamp field ,if we want to do filter based on timestamp.
yes you need a time based field in your documents, that you are indexing (or use the timestamp field mapper). Then you can use a time based range query to filter, see the documentation about range queries
If you have problems, please provide fully fledged examples as mentioned in our help guidelines, so other people can chime in and follow your problem by concrete examples.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.