VRL templates #17501
Labels
domain: vrl
Anything related to the Vector Remap Language
type: feature
A value-adding code addition that introduce new functionality.
A note for the community
Proposal
Today templates are very limited, they can only contain the following:
It would be nice to allow the full power of VRL to calculate template values. For example, a field reference in a template today will generally return an error if the field is missing. In VRL, it could choose an arbitrary default.
VRL supports read-only mode (currently used in VRL conditions), which can prevent mutations. This was one of the issues in the previous RFC.
It can also (with a minor change) type check the result of the VRL template to ensure it always returns a string.
Some sinks (such as
Loki
) allow deleting fields after they are referenced in a template. I suggest that VRL templates are immutable and never modify the event, they only can calculate and return a new value. If there is data that should be used in a template, but not sent to the sink, it should be moved into event metadata first (in aremap
transform).Since the templating logic is very limited today, this can probably be made fully backwards compatible, so either a "legacy" template, or a VRL script can be used in a template. Internally all templates will be converted to a VRL script. A warning could even be generated if the "legacy" templates are being used, with the VRL code that it can be converted to.
Previous RFC: #4905
The text was updated successfully, but these errors were encountered: