-
Why the alerts are not displaying the summary table content and are instead sending each alert separately? Using Docker image jertel/elastalert2:2.19.0. ElasticSearch indexPOST applog/_doc
{
"appname": "cms",
"level": "error",
"message": "i am cms 1",
"extra": "abc",
"@timestamp": "2024-09-07T12:37:12.000+08:00"
}
POST applog/_doc
{
"appname": "cms",
"level": "error",
"message": "i am cms 3",
"extra": "abc",
"@timestamp": "2024-09-07T12:37:14.000+08:00"
} Rules configurationname: alert by level field
type: blacklist
index: applog
compare_key: level
blacklist:
- error
- err
- fatal
aggregation:
minutes: 1
aggregation_key:
- appname.keyword
summary_table_fields:
- appname.keyword
- count
- message
alert:
- debug Output debug logsKey log fragments ...
elastalert-elastalert2-1 | INFO:elastalert:New aggregation for alert by level field, aggregation_key: cms. next alert at 2024-09-07 04:39:04.332983+00:00.
elastalert-elastalert2-1 | INFO:elastalert:Adding alert for alert by level field to aggregation(id: 7GfGypEB5rLNh48YYVpW, aggregation_key: cms), next alert at 2024-09-07 04:39:04.332983+00:00
...
elastalert-elastalert2-1 | INFO:elastalert:alert by level field
elastalert-elastalert2-1 |
elastalert-elastalert2-1 | @timestamp: 2024-09-07T12:37:12+08:00
elastalert-elastalert2-1 | _id: 6mfGypEB5rLNh48YUlre
elastalert-elastalert2-1 | _index: applog
elastalert-elastalert2-1 | appname: cms
elastalert-elastalert2-1 | appname.keyword: cms
elastalert-elastalert2-1 | extra: abc
elastalert-elastalert2-1 | level: error
elastalert-elastalert2-1 | message: i am cms 1
elastalert-elastalert2-1 | num_hits: 2
elastalert-elastalert2-1 | num_matches: 2
elastalert-elastalert2-1 |
elastalert-elastalert2-1 | INFO:elastalert:Alert for alert by level field at 2024-09-07T12:37:14+08:00:
elastalert-elastalert2-1 | INFO:elastalert:alert by level field
elastalert-elastalert2-1 |
elastalert-elastalert2-1 | @timestamp: 2024-09-07T12:37:14+08:00
elastalert-elastalert2-1 | _id: 62fGypEB5rLNh48YUlr-
elastalert-elastalert2-1 | _index: applog
elastalert-elastalert2-1 | appname: cms
elastalert-elastalert2-1 | appname.keyword: cms
elastalert-elastalert2-1 | extra: abc
elastalert-elastalert2-1 | level: error
elastalert-elastalert2-1 | message: i am cms 3
elastalert-elastalert2-1 | num_hits: 2
elastalert-elastalert2-1 | num_matches: 2
elastalert-elastalert2-1 | The full log
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Per the docs, aggregation_key isn't supported by the Blacklist or Whitelist rule types: |
Beta Was this translation helpful? Give feedback.
-
It's not clear from the logs what's going on with your test. In one log file it's showing that all three events are being treated as a separate aggregation, even though two of them use "alice" as the username. It's unknown if there's a username vs username.keyword issue, or something is off in the raw event data itself (trailing spaces, etc). Also, the debug alerter doesn't support rendering summary tables. |
Beta Was this translation helpful? Give feedback.
-
@jertel The problem has been solved, thank you very much! Below is my rule code name: test
type: any
index: test
aggregation:
minutes: 1
aggregation_key: 'my_data.username.keyword'
summary_table_fields:
- my_data.username.keyword
- my_data.event_type.keyword
alert:
- email
email: [email protected]
smtp_host: smtp.qq.com
smtp_port: 465
smtp_ssl: true
smtp_auth_file: /opt/elastalert/rules/email_auth
from_addr: [email protected] The email i had received: |
Beta Was this translation helpful? Give feedback.
It's not clear from the logs what's going on with your test. In one log file it's showing that all three events are being treated as a separate aggregation, even though two of them use "alice" as the username. It's unknown if there's a username vs username.keyword issue, or something is off in the raw event data itself (trailing spaces, etc).
Also, the debug alerter doesn't support rendering summary tables.