elastalert icon indicating copy to clipboard operation
elastalert copied to clipboard

no alert hits, but should have some

Open cjj137783 opened this issue 9 years ago • 1 comments

hello ,sorry to disturb,but I need some help , my elastalert did not work ,please help me

below is my rule config:

name: Example rule
type: frequency
use_local_time: True
timestamp_type: unix
index: logstash*
num_events: 5
timeframe:
  hours: 12
filter:
- term:
    some_field: "source"
alert:
- "email"
smtp_host: smtp.mail.aliyun.com
smtp_port: 25
smtp_auth_file: smtp_auth_file.yaml
email_reply_to: [email protected]
from_addr: [email protected]_

and below is the data in my elasticsearch: @message @timestamp @source @type @source_host @source_path joe:30:xx 2017-02-10T01:53:47.872Z joe 30 192.168.3.215 xx joe:30:xx 2017-02-10T01:53:47.872Z joe 30 192.168.3.215 xx joe:30:xx 2017-02-10T01:53:47.872Z joe 30 192.168.3.215 xx joe:30:xx 2017-02-10T01:53:47.872Z joe 30 192.168.3.215 xx joe:30:xx 2017-02-10T01:53:47.872Z joe 30 192.168.3.215 xx joe:30:xx 2017-02-10T01:53:47.872Z joe 30 192.168.3.215 xx joe:30:xx 2017-02-10T01:53:47.872Z joe 30 192.168.3.215 xx joe:30:xx 2017-02-10T01:53:47.872Z joe 30 192.168.3.215 xx joe:30:xx 2017-02-10T01:53:47.872Z joe 30 192.168.3.215 xx

but when I run the command elastalert-test-rule rules/example_frequency.yaml

the output is : _[root@os235 elastalert-master]# elastalert-test-rule rules/example_frequency.yaml Successfully loaded Example rule

INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 192.168.3.215 INFO:elastalert:Note: In debug mode, alerts will be logged to console but NOT actually sent. To send them, use --verbose. INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 192.168.3.215 INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 192.168.3.215 INFO:elastalert:Queried rule Example rule from 2017-02-09 10:10 CST to 2017-02-09 10:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 10:25 CST to 2017-02-09 10:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 10:40 CST to 2017-02-09 10:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 10:55 CST to 2017-02-09 11:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 11:10 CST to 2017-02-09 11:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 11:25 CST to 2017-02-09 11:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 11:40 CST to 2017-02-09 11:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 11:55 CST to 2017-02-09 12:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 12:10 CST to 2017-02-09 12:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 12:25 CST to 2017-02-09 12:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 12:40 CST to 2017-02-09 12:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 12:55 CST to 2017-02-09 13:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 13:10 CST to 2017-02-09 13:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 13:25 CST to 2017-02-09 13:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 13:40 CST to 2017-02-09 13:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 13:55 CST to 2017-02-09 14:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 14:10 CST to 2017-02-09 14:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 14:25 CST to 2017-02-09 14:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 14:40 CST to 2017-02-09 14:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 14:55 CST to 2017-02-09 15:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 15:10 CST to 2017-02-09 15:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 15:25 CST to 2017-02-09 15:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 15:40 CST to 2017-02-09 15:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 15:55 CST to 2017-02-09 16:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 16:10 CST to 2017-02-09 16:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 16:25 CST to 2017-02-09 16:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 16:40 CST to 2017-02-09 16:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 16:55 CST to 2017-02-09 17:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 17:10 CST to 2017-02-09 17:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 17:25 CST to 2017-02-09 17:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 17:40 CST to 2017-02-09 17:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 17:55 CST to 2017-02-09 18:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 18:10 CST to 2017-02-09 18:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 18:25 CST to 2017-02-09 18:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 18:40 CST to 2017-02-09 18:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 18:55 CST to 2017-02-09 19:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 19:10 CST to 2017-02-09 19:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 19:25 CST to 2017-02-09 19:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 19:40 CST to 2017-02-09 19:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 19:55 CST to 2017-02-09 20:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 20:10 CST to 2017-02-09 20:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 20:25 CST to 2017-02-09 20:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 20:40 CST to 2017-02-09 20:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 20:55 CST to 2017-02-09 21:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 21:10 CST to 2017-02-09 21:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 21:25 CST to 2017-02-09 21:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 21:40 CST to 2017-02-09 21:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 21:55 CST to 2017-02-09 22:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 22:10 CST to 2017-02-09 22:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 22:25 CST to 2017-02-09 22:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 22:40 CST to 2017-02-09 22:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 22:55 CST to 2017-02-09 23:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 23:10 CST to 2017-02-09 23:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 23:25 CST to 2017-02-09 23:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 23:40 CST to 2017-02-09 23:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-09 23:55 CST to 2017-02-10 00:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 00:10 CST to 2017-02-10 00:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 00:25 CST to 2017-02-10 00:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 00:40 CST to 2017-02-10 00:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 00:55 CST to 2017-02-10 01:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 01:10 CST to 2017-02-10 01:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 01:25 CST to 2017-02-10 01:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 01:40 CST to 2017-02-10 01:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 01:55 CST to 2017-02-10 02:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 02:10 CST to 2017-02-10 02:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 02:25 CST to 2017-02-10 02:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 02:40 CST to 2017-02-10 02:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 02:55 CST to 2017-02-10 03:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 03:10 CST to 2017-02-10 03:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 03:25 CST to 2017-02-10 03:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 03:40 CST to 2017-02-10 03:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 03:55 CST to 2017-02-10 04:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 04:10 CST to 2017-02-10 04:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 04:25 CST to 2017-02-10 04:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 04:40 CST to 2017-02-10 04:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 04:55 CST to 2017-02-10 05:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 05:10 CST to 2017-02-10 05:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 05:25 CST to 2017-02-10 05:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 05:40 CST to 2017-02-10 05:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 05:55 CST to 2017-02-10 06:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 06:10 CST to 2017-02-10 06:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 06:25 CST to 2017-02-10 06:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 06:40 CST to 2017-02-10 06:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 06:55 CST to 2017-02-10 07:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 07:10 CST to 2017-02-10 07:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 07:25 CST to 2017-02-10 07:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 07:40 CST to 2017-02-10 07:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 07:55 CST to 2017-02-10 08:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 08:10 CST to 2017-02-10 08:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 08:25 CST to 2017-02-10 08:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 08:40 CST to 2017-02-10 08:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 08:55 CST to 2017-02-10 09:10 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 09:10 CST to 2017-02-10 09:25 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 09:25 CST to 2017-02-10 09:40 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 09:40 CST to 2017-02-10 09:55 CST: 0 / 0 hits INFO:elastalert:Queried rule Example rule from 2017-02-10 09:55 CST to 2017-02-10 10:10 CST: 0 / 0 hits

Would have written the following documents to writeback index (default is elastalert_status):

elastalert_status - {'hits': 0, 'matches': 0, '@timestamp': datetime.datetime(2017, 2, 10, 2, 10, 6, 561962, tzinfo=tzutc()), 'rule_name': 'Example rule', 'starttime': datetime.datetime(2017, 2, 9, 2, 10, 6, 178553, tzinfo=tzutc()), 'endtime': datetime.datetime(2017, 2, 10, 2, 10, 6, 178553, tzinfo=tzutc()), 'time_taken': 0.38051891326904297}_

did I do something wrong ? I spent two days to solve this problem, but failed to solve!

I need you help ,thanks a lot

cjj137783 avatar Feb 10 '17 02:02 cjj137783

Your timestamp type is not unix. Remove that.

Why do you believe some_field: "source" will match anything? I don't see "some_field" or "source" appearing anywhere in the example documents you provided. I'm assuming these were changed for posting to github, but this filter is almost certainly your problem.

Qmando avatar Feb 10 '17 17:02 Qmando