Open gethvi opened 8 months ago
Yes, it requires relative paths. I've updated the documentation to reflect this. We cannot change it to use absolute paths since it will break existing users configurations. However, if you're interested in adding an additional field named jinja_template_base_path
then that value could allow users to change the behavior:
jinja_template_base_path: ""
=> Templates will be provided via relative paths under the current working directory (existing default behavior)jinja_template_base_path: "/"
=> Templates will be provided via absolute pathsjinja_template_base_path: "/some/other/path"
=> Templates will be provided via relative paths under the given parent directoryThe value would be supplied on line 149 of loaders.py
.
Thanks for raising the issue.
This issue is stale because it has been open for 6 months with no activity. Stale issues convey that the issue, while important to someone, is not critical enough for the author, or other community members to work on, sponsor, or otherwise shepherd the issue through to a resolution.
Hi,
using
elastalert2==2.15.0
we encountered an error with jinja2 absolute template path not working:It raises the following exception:
Elastalert is installed like this:
And used with custom systemd unit file:
After some digging through the source code of elastalert2 and experimentation, it works with the following rule settings:
Using the relative path (considering the working directory set by the systemd unit file) it works. However for a regular user it is not very intuitive to set the
jinja_template_path
to a relative path and the documentation doesn't mention it.