Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support list expansion based on dynamic variables #735

Open
ChrsMark opened this issue Jul 19, 2022 · 3 comments
Open

Support list expansion based on dynamic variables #735

ChrsMark opened this issue Jul 19, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@ChrsMark
Copy link
Member

Describe the enhancement:
As a user I would like to have the option for expanding a yml list using a list coming from a dynamic provider.

Describe a specific use case for the enhancement or feature:
In case I want to expand the list of processors with processors coming from a dynamic provider, I'm not able to achieve this.

Example:

providers:
  local_dynamic:
    items:
      - vars:
          key: value1
          procs:
             - add_fields:
                  fields:
                    custom: bar
                  target: dynamic  
             - add_fields:
                  fields:
                    hints: true
                  target: kubernetes

inputs:
  - type: logfile
    enabled: true
    streams:
      - paths:
          - /var/log/${local_dynamic.key}
        processors:
          - add_fields:
              fields:
                custom2: foo
              target: baz
         ${local_dynamic.procs}

In the above example I would like to expand the processors list with the list coming from the local provider.

@ph
Copy link
Contributor

ph commented Jul 25, 2022

Interesting, what you are asking is actually similar to yaml reference using the ampersand.

@ChrsMark
Copy link
Member Author

Yeap but we need to handle this on Agent's code since on pure yaml it is not supported to merge lists/arrays dynamically: yaml/yaml#35

@ph
Copy link
Contributor

ph commented Jul 25, 2022

I believe we would need to change quite a fews thing internally to support object like structure. Maybe we should even make this an explicit decision with a prefix key keyword. Maybe a bad example syntax but to better illustrate what I mean, ${local_dynamic.proces:expand} or ${local_dynamic.proces:object}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants