ElastAlert not getting any Query Hits
Hello,
I'm testing Elasticsearch with ElastAlert to learn how to use them and I encountered a small problem.
First of all, I'm using a training sample which looks like this, size 1000 :
{
"_index" : "bank",
"_type" : "account",
"_id" : "44",
"_score" : 1.0,
"_source" : {
"account_number" : 44,
"balance" : 34487,
"firstname" : "Aurelia",
"lastname" : "Harding",
"age" : 37,
"gender" : "M",
"address" : "502 Baycliff Terrace",
"employer" : "Orbalix",
"email" : "[email protected]",
"city" : "Yardville",
"state" : "DE"
}
Now I installed ElastAlert and ran.
python -m elastalert.elastalert --verbose --rule example_rules/example_blacklist.yaml
And I get this :
INFO:elastalert:Starting up WARNING:elasticsearch:GET /elastalert_status/elastalert/_search?size=1000 [status:400 request:0.018s] INFO:elastalert:Queried rule Example rule from 2016-03-11 03:48 PST to 2016-03-11 04:03 PST: 0 hits INFO:elastalert:Ran Example rule from 2016-03-11 03:48 PST to 2016-03-11 04:03 PST: 0 query hits, 0 matches, 0 alerts sent INFO:elastalert:Sleeping for 59 seconds
I have 0 query hits and I don't know why. Looks like the problem is in the WARNING quote but I don't get it either.
I used blacklist as a test because, to me, it looked easier to use on the sample I'm using. I also tried with Any type without success, and Frequency type which of course wouldn't work here.
example_blacklist.yaml :
es_host: localhost
es_port: 9200
name: Example rule
type: blacklist
index: bank-*
filter:
- term:
gender: "f"
compare_key: "state"
blacklist:
- "AL"
- "al"
- "DE"
- "de"
- "WY"
- "wy"
- "WV"
- "wv"
alert:
- "email"
email:
- "[email protected]"
I had no problem hitting what I wanted with Elasticsearch + Query so I don't get why I have 0 hits here. I looked up status 400 before, couldn't find anything.
Thank you
You need timestamped data to use Elastalert.
Ok, I got a new data set with time stamp. But I still have this problem :
WARNING:elasticsearch:GET /elastalert_status/elastalert/_search?size=1000 [status:400 request:0.018s]
The index I'm working on is in elastalert_status, but why is it searching in "elastalert_status/elastalert" ? There won't be any data in this and how can I change this ?
Please read this section of the documantation. http://elastalert.readthedocs.org/en/latest/elastalert_status.html
Elastalert saves some state in the elastalert_status index to resume where it left off it it is stopped and started. The elastalert _type specifically might be used for aggregated alerts, or retrying alerts that failed. You should not worry about these queries being made.