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

Feature Request - Add files property to remap transform #21485

Open
brittonhayes opened this issue Oct 11, 2024 · 0 comments
Open

Feature Request - Add files property to remap transform #21485

brittonhayes opened this issue Oct 11, 2024 · 0 comments
Assignees
Labels
transform: remap Anything `remap` transform related type: feature A value-adding code addition that introduce new functionality.

Comments

@brittonhayes
Copy link

brittonhayes commented Oct 11, 2024

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Use Cases

The proposed feature would allow users to break down Vector remaps into smaller, more manageable units of configuration. This would enable:

  1. Improved organization of VRL code
  2. Easier sharing of VRL snippets across components
  3. Better testability of individual remap sections
  4. Simplified maintenance of complex transformations

Attempted Solutions

Currently, users can only specify a single file for the remap transform using the file property. To achieve similar functionality, users might:

  1. Create multiple remap components, which can be cumbersome and less efficient.
  2. Use external tools like jsonnet to combine multiple VRL files, adding complexity to the configuration process.

However, these solutions do not provide the seamless experience that a native files property would offer.

Proposal

Add a new files property to the remap transform that accepts an array of file paths. When files is provided (and file or source are not), Vector would concatenate the contents of the specified VRL files with a newline separator.

Example configuration:

transforms:
  my_transform_id:
    type: remap
    inputs:
      - my-source-or-transform-id
    files:
      - ./my/remap_a.vrl
      - ./my/remap_b.vrl

This would be equivalent to:

transforms:
  my_transform_id:
    type: remap
    inputs:
      - my-source-or-transform-id
    source: |
      # Contents of ./my/remap_a.vrl
      . = parse_json!(string!(.message))
      .timestamp = to_unix_timestamp(to_timestamp!(.timestamp))

      # Contents of ./my/remap_b.vrl
      del(.username)
      .message = downcase(string!(.message))

This feature would allow users to organize their VRL code into smaller, more manageable files while still benefiting from the efficiency of a single remap transform.

References

No directly related issues found. This feature request is based on user needs for improved VRL management and configuration flexibility.

Version

0.41.0

@brittonhayes brittonhayes added the type: feature A value-adding code addition that introduce new functionality. label Oct 11, 2024
@jszwedko jszwedko added the transform: remap Anything `remap` transform related label Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
transform: remap Anything `remap` transform related type: feature A value-adding code addition that introduce new functionality.
Projects
None yet
Development

No branches or pull requests

2 participants