You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Remap language returns its last expression as a value when executed. This value can be a string, bool, integer, etc.
When using Remap in the context of a so-called "condition" within Vector, such as:
[transforms.reduce]
type = "reduce"ends_when.type = "remap"ends_when.source = "<source code here>"
The condition expects to receive a boolean, which determines if reduced logs are emitted.
Currently, any non-boolean value in a remap-conditional is considered to be "false". For example:
ends_when.source = 'upcase("foo")'# is interpreted by the conditional logic as "false"
Goal
The goal of this RFC is to make the above example a compile-time error. The user is forced to explicitly return a boolean value in a conditional, for example by using the to_bool function:
This should not apply to the remap transform, as its return value is ignored (its expressions are used to manipulate the event itself, not to return a final script value). The remap transform scripts should thus be allowed to return any value.
The text was updated successfully, but these errors were encountered:
The Remap language returns its last expression as a value when executed. This value can be a string, bool, integer, etc.
When using Remap in the context of a so-called "condition" within Vector, such as:
The condition expects to receive a boolean, which determines if reduced logs are emitted.
Currently, any non-boolean value in a remap-conditional is considered to be "false". For example:
Goal
The goal of this RFC is to make the above example a compile-time error. The user is forced to explicitly return a boolean value in a conditional, for example by using the
to_bool
function:This should not apply to the remap transform, as its return value is ignored (its expressions are used to manipulate the event itself, not to return a final script value). The remap transform scripts should thus be allowed to return any value.
The text was updated successfully, but these errors were encountered: