elastalert icon indicating copy to clipboard operation
elastalert copied to clipboard

Alert content output for spike rules

Open Trustys opened this issue 9 years ago • 3 comments

I'm asking if the alert content for spike rules is limited. (alert is working well, the issue is only on the content output)

Using alert_subject/text_args, I can only get one field in the alert output : "source"

Here is the yaml :

name: "spiketest" index: graylog_* filter:

  • query: query_string: query: 'event_ip: 1.2.3.4'

type: spike spike_height: 3 spike_type: up

query_key: source use_terms_query: true doc_type: message

timeframe: minutes: 3

alert_subject_args: ["event_ip"] alert_subject: "Spike_for_{0}"

alert_text_args: ["event_ip", "event_src", "source"] alert_text: | IP: {0} Event source: {1} Source: {2}

alert_text_type: alert_text_only

Here is the output :

Spike_for_MISSING VALUE

IP: MISSING VALUE. Event source: MISSING VALUE Source: client_test

Here is json from a document :

{ "_index" : "graylog_41", "_type" : "message", "_id" : "668a5190-3ad7-11e7-8a84-0242ac120006", "_version" : 1, "found" : true, "_source" : { "event_facility" : "9", "level" : 6, "streams" : [ "000000000000000000000001" ], "event_severity" : "6", "source" : "client_test", "message" : "(CRON) info (No MTA installed, discarding output)", "type" : "syslog", "gl2_source_input" : "58e6013eb9d8210001e5600a", "@timestamp" : "2017-05-17T08:04:06.987Z", "full_message" : "(CRON) info (No MTA installed, discarding output)", "event_prog" : "CRON", "gl2_source_node" : "363a611c-edc8-4f56-9d7e-0d35633ef004", "event_src" : "client_test", "facility" : "gelf-rb", "event_time" : "2017-05-17T10:04:06+02:00", "timestamp" : "2017-05-17 08:04:06.987", "event_ip" : "1.2.3.4" }

We can see that fields requested in alert output (event_ip and event_source) exists so that's why I'm asking if output fields for spike are limited

When using no argument for alert content, I have this output :

IP: MISSING VALUE . Event source: MISSING VALUE Source: client_test

An abnormal number (82) of events occurred around 2017-05-17 16:47 CEST. Preceding that time, there were only 19 events within 0:03:00

@timestamp: 2017-05-17T14:47:21.307403Z reference_count: 19 source: client_test spike_count: 82

Thanks for your support ! :-)

Trustys avatar May 17 '17 14:05 Trustys

Does somebody could give a feedback on the output for this type of rule (spike) ?

Thx ! :-)

Trustys avatar May 22 '17 12:05 Trustys

When you add use_terms_query: true, Elastalert only get's numbers back from Elasticsearch, not full fields. If you remove that, you'll get the full document that triggered the alert.

You don't have to remove that though. you can also add top_count_keys. See http://elastalert.readthedocs.io/en/latest/ruletypes.html?highlight=top_count_keys#top-count-keys

top_count_keys:
 - field1
 - field2

Qmando avatar May 22 '17 18:05 Qmando

Works perfectly now. Thank you @Qmando !

Trustys avatar May 23 '17 09:05 Trustys