elastalert icon indicating copy to clipboard operation
elastalert copied to clipboard

Cardinality for event correlation with more than 2 terms not working as expected

Open beaesteban01 opened this issue 5 years ago • 2 comments

Hi @Qmando, Hi, I am facing the following problem while correlating 3 rules with cardinality rule. My situation is the following: I want the R4 (cardinality) to trigger when R1, R2 AND R3 occur in 3 minutes. It works perfectly when the 3 of them are triggering, but if one of them stops, R4 still triggers for the other 2. However, testing only with 2 rules, if one of them is not triggering, the cardinality rule doesn't either (as expected). I don't know how to force that only triggers only if the 3 rules are occurring, someone knows how to fix it?

Here my R4-cardinality rule:

type: cardinality
cardinality_field: rule_name
max_cardinality: 1

index: elastalert_status
timeframe:
 # hours: 1
  minutes: 3

aggregation:
  minutes: 2
filter:
 - terms:
     rule_name: [r2_1_redmov, r2_2_wifi, r2_3_ids]

I have also tried writing the filter as

filter:
 - terms:
     rule_name:
         - r2_1_redmov
         - r2_2_wifi
         - r2_3_ids

Thank you very much!

beaesteban01 avatar Feb 10 '21 08:02 beaesteban01

max_cardinality: 2 ?

satyavadali avatar Feb 10 '21 13:02 satyavadali

@satyavadali yes! I just figured that out recently. Thank you very much!!

beaesteban01 avatar Feb 10 '21 13:02 beaesteban01