vector icon indicating copy to clipboard operation
vector copied to clipboard

Ability to change the default templating syntax

Open atibdialpad opened this issue 4 years ago • 1 comments

It should be possible to change vector template variables to use something other than curly brackets {{ var }}. For example, in jinja2 we can do something like #jinja2: variable_start_string: '[%', variable_end_string: '%]' .Something in global config to change the default behaviour probably. Would help in cases for example when ansible is used to copy vector configs and ansible tries to resolve {{ foo }} but this was not a ansible variable, rather it was supposed to be a vector variable.

JFYI: @jszwedko

atibdialpad avatar May 25 '21 14:05 atibdialpad

Whoever stucked on configuring vector via ansible, I solved this issue via this stuff:

...
transforms:
    throttle_journald:
      type: throttle
      inputs:
        - src_kernel
        - src_units
      key_field: "{{ '{{ \"{{ SYSLOG_IDENTIFIER \"}} }}' }}"
      threshold: 200
      window_secs: 200
...

to become

...
transforms:
    throttle_journald:
      type: throttle
      inputs:
        - my_src
      key_field: '{{ SYSLOG_IDENTIFIER }}'
      threshold: 200
      window_secs: 200
...

Jerrimikkihvatai avatar Aug 13 '24 13:08 Jerrimikkihvatai

Would be great to have an option to set for example

template.delimiters="[[ ]]"

or similar which will solve here a lot in this creepy escaping.

szibis avatar Sep 29 '24 20:09 szibis

Similar issue happen when we use helmfile over helm which put us in double templating place and we need double escape just like in this above example with ansible and jina2 templating over helmfile. This makes setup crazy to manage.

szibis avatar Sep 29 '24 20:09 szibis