Aggregation not working as expected
Hi,
I have this rule:
#Alerts for archive monitor events (missing/failed download) name: Missing Download Alert type: any index: logstash-dpmonitor-* alert: email email: "[email protected]" aggregration: minutes: 10 summary_table_fields:
- body include: ["body"] filter:
- term: header.raw: "File Arrival Time Exceeded"
and am running this command:
elastalert --debug --rule rules/missing_download_alert.yaml --start 2016-11-15T12:00:00 --end 2016-11-15T12:15:00 --config elastalert/configs/config.yaml
and getting this output:
INFO:elastalert:Note: In debug mode, alerts will be logged to console but NOT actually sent. To send them, use --verbose. INFO:elastalert:Starting up INFO:elastalert:Queried rule Missing Download Alert from 2016-11-15 04:00 PST to 2016-11-15 04:15 PST: 764 / 764 hits INFO:elastalert:Skipping writing to ES: {'rule_name': 'Missing Download Alert', '@timestamp': '2016-11-21T21:19:29.314448Z', 'exponent': 0, 'until': '2016-11-21T21:20:29.314439Z'} INFO:elastalert:Alert for Missing Download Alert at 2016-11-15T12:00:44.242Z: INFO:elastalert:Missing Download Alert
@timestamp: 2016-11-15T12:00:44.242Z _id: AVhn3Fu_CwOJ2QGnw5Xd _index: logstash-dpmonitor-2016.11.15 _type: %{[@metadata][type]} body: path/to/file: last successful file on: Mon Nov 14 14:05:02 PST 2016
INFO:elastalert:Ignoring match for silenced rule Missing Download Alert INFO:elastalert:Ignoring match for silenced rule Missing Download Alert INFO:elastalert:Ignoring match for silenced rule Missing Download Alert ... 100s more of these messages INFO:elastalert:Ignoring match for silenced rule Missing Download Alert INFO:elastalert:Ignoring match for silenced rule Missing Download Alert INFO:elastalert:Skipping writing to ES: {'hits': 764, 'matches': 764, '@timestamp': '2016-11-21T21:19:29.357708Z', 'rule_name': 'Missing Download Alert', 'starttime': '2016-11-15T12:00:00Z', 'endtime': '2016-11-15T12:15:00Z', 'time_taken': 0.3736441135406494} INFO:elastalert:Ran Missing Download Alert from 2016-11-15 04:00 PST to 2016-11-15 04:15 PST: 764 query hits, 764 matches, 0 alerts sent
The documentation for aggregation says:
This option allows you to aggregate multiple matches together into one alert. Every time a match is found, ElastAlert will wait for the aggregation period, and send all of the matches that have occurred in that time for a particular rule together.
and summary_fields_table says:
For aggregations, there can sometimes be a large number of documents present in the viewing medium (email, jira ticket, etc..). If you set the summary_table_fields field, Elastalert will provide a summary of the specified fields from all the results.
My expectation is the body of the alert will contain a table with all the uniques value in "body" for each match, but it only shows the body field for 1 matched event. Why is the summary_field_table not showing in the alert? Why are all but 1 matches being ignored? Thanks.
++ 1 @Qmando
Sorry for very late response here. The default value for realert is 1 minute, which prevents all except the first match from actually becoming an alert.
You need to add
realert:
mintues: 0
This problem is made more obvious when you are using --start because the entire time period's worth of matches occur "at the same time". This is a terrible default when aggregation is set, so I'll change it.
sir , while using summary_table_field , field used is componentName in my rule , but each time a get single mail with single component name and the table does not include any other componentName,
@ayush1396
It's possible to have aggregation set but there's only 1 event. In that case, the table just has 1 row.
Or, if you set aggregation_key: componentName, it will only show up as one componentName at a time.
Or, if you don't have realert set to 0, maybe it ignored these multiple events because they occurred too close to each other.