Yelp / elastalert

Easy & Flexible Alerting With ElasticSearch
https://elastalert.readthedocs.org
Apache License 2.0
7.99k stars 1.73k forks source link

KeyError: When observable field is empty in a match #3167

Open fopson opened 3 years ago

fopson commented 3 years ago

Hi all, is there a way to force elastalert to ignore the KeyError: when a match field in the observable mapping is empty or inexistent? What I am trying to acheive is to automatically attach the observables to the alert (if and when they exist) before sending to TheHive as shown below:

hive_observable_data_mapping:
  - ip: "{match[source][ip]}"
  - ip: "{match[destination][ip]}"
  - ip: "{match[host][ip]}"
  - ip: "{match[client][ip]}"
  - ip: "{match[server][ip]}"

The problem is, all these fields are not always present in a match: some times, a combination of 2 or 3 and some time none at all. Whenever any one of these field in not present, Elastalert will result to an error and not send the alert to thehive at all.

elastalert04

I wonder if there is a solution to this issue.