elastalert and jinja not working #9534
Replies: 1 comment 3 replies
-
The YAML that you're starting with was used by Salt to generate the config file via Jinja -- Elastalert doesn't actually interpret Jinja on its own, so that's why its not converting the matches properly. I would suggest removing the Jinja pieces and using the standard Elastalert syntax for hive_alert_config and hive_observable_data_mapping -- documentation is available here: https://elastalert2.readthedocs.io/en/latest/ruletypes.html#thehive --Matt |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We are trying to send alerts to Hive and it doesn't seem like elastalert is converting it
I tried starting with the yaml here: https://github.com/Security-Onion-Solutions/securityonion/blob/5b16a6542231877906cb5f2ec0032a5ab50fd43f/salt/elastalert/files/rules/so/suricata_thehive.yaml
the top lines don't seem to work, but I was able to work around it by hard coding the four values.
But when I try to send it I am getting hard coded values like an ip of ip: {match[source][ip]}
It's like it doesn't know jinja exists?
also should we be using things like ip: '{match[source][ip]}' or like ip: '{match[source.ip]}' ?
When I run so-elastalert-test it references items like source.ip
This is what my script looks like:
Elastalert rule to forward Suricata alerts from Security Onion to a specified TheHive instance.
https://xx.xx.xx.xx/#/hunt?q=network.community_id%3A%20%20%22{{match[network.community_id]}}%22%20%7C%20groupby%20source.ip%20destination.ip,event.module,%20event.dataset
Kibana Dashboard Pivot:
https://xx.xx.xx.xx/kibana/app/kibana#/dashboard/30d0ac90-729f-11ea-8dd2-9d8795a1200b?_g=(filters:!(('$state':(store:globalState),meta:(alias:!n,disabled:!f,index:'2289a0c0-6970-11ea-a0cd-ffa0f6a1bc29',key:network.community_id,negate:!f,params:(query:{{match[network.community_id]}}),type:phrase),query:(match_phrase:(network.community_id:{{match[network.community_id]}})))),refreshInterval:(pause:!t,value:0),time:(from:now-7d,to:now))
`IPs: {{match[source.ip]}}:{{match[source.port]}} --> {{match[destination.ip]}}:{{match[destination.port]}}
Signature:{{match[rule.rule]}}
Beta Was this translation helpful? Give feedback.
All reactions