elastalert icon indicating copy to clipboard operation
elastalert copied to clipboard

Alert if there is no value in a particular field in last 15 minutes Events

Open suchandbabu opened this issue 8 years ago • 2 comments

Hi, @Qmando

Thanks for your support.

I am trying to create rule to alert if a specific field is not there in last 15 event logs in a particular index.

Here i am receiving firewall logs with the field name "logsrc: F300" in a filebeat index. I need to get an alert If there is no logsrc field OR if there is no F300 value in logsrc fields for last 15 minute. Actually here am receiving firewall logs into messge field and i created the field logsrs.logsrcip,logdstip etc using grok parsing.

I tried using rule type cardinality cardinality_field: "logsrc"

min_cardinality: 1 timeframe: minutes: 15

filter:

  • term: logsrc: F300

But its not triggering as expected. Can you please help me to resolve this.

suchandbabu avatar Mar 17 '18 12:03 suchandbabu

Filtering on a field you are counting the cardinality for doesn't make sense, you will only ever get F300. logsrc is probably an analyzed field too, so that filter wont work, unless you lowercase it, like I did below.

type: flatline
timeframe:
  minutes: 15
filter:
 - term:
      logsrc: f300
threshold: 1

This will match "If there is no logsrc field OR if there is no F300 value in logsrc fields for last 15 minute"

Qmando avatar Mar 19 '18 20:03 Qmando

Thank you so much.

suchandbabu avatar Mar 20 '18 04:03 suchandbabu