You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it would be possible to have access to custom python functions in the alert_text when using alert_text_jinja as an alert type.
When we load the jinja template it could be possible to update the globals to inject a dict that points to some custom python functions.
I have had a case where a list of dictionaries is stored as a string in Elastic (maybe it's a common case, I don't know, I am kind of new to Elastalert). When I want to use jinja I haven't found a way to split it with what they offer. However it would be possible with some custom functions.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I think it would be possible to have access to custom python functions in the alert_text when using alert_text_jinja as an alert type.
When we load the jinja template it could be possible to update the globals to inject a dict that points to some custom python functions.
I have had a case where a list of dictionaries is stored as a string in Elastic (maybe it's a common case, I don't know, I am kind of new to Elastalert). When I want to use jinja I haven't found a way to split it with what they offer. However it would be possible with some custom functions.
I was able to modify the code locally and it worked quite easily (code wasn't clean though). I used something like this: https://saidvandeklundert.net/2020-12-24-python-functions-in-jinja/
I am open to code the feature myself, but I am new to git/github (I have been using hg for several years though)
Thanks
Beta Was this translation helpful? Give feedback.
All reactions