Is it possible to attach related events in a cardinality rule?
Hi! I am pretty new to Elastalert. I was wondering if there is any way to attach the related events that make my cardinality rule trigger to the same alert instead of having different alerts, as it is possible with the frequency rule with attach_related: true .
My problem is the following: I have the cardinality rule below, that looks for the "rule_name" field and outputs 3 different alerts as I have set max_cardinality: 2, and works as I expect. But what I want is to have the information of the 3 alerts in only 1 alert, with the format that gives the ```attach_related: true```` option of frequency rules, although as far as I understand from documentation it is not an option in cardinality.
name: r_correlacion_pru
type: cardinality
cardinality_field: rule_name
max_cardinality: 2
index: elastalert_status_pruebas
timeframe:
# hours: 1
minutes: 3
realert:
minutes: 0
filter:
- terms:
rule_name:
- r1_
- r2_
- r3_
alert:
- "debug"
Another option that would be valid for my case would be to use a filter that works "ANDing" the values for the field, because
num_events: 3
filter:
- terms:
rule_name:
- r1_
- r2_
- r3_
used in a frequency rule seems to work like and OR filter and the alerts I get don't necessarily have the r1_, r2_ and r_3 fields, instead 2 alerts for r_1 and one for r_3, but I don't really understand how to make this "AND" filter for the same field. Following the documentation, I have tried with this
- query:
query_string:
query: "this: that AND these: those"
but changing to
query: "rule_name: r1_ AND rule_name: r2_ AND rule_name: r3_"
but it does not work.
Thank you very much! Bea