forked from vectordotdev/vector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(route transform): Add option to enable/disable unmatched output (v…
…ectordotdev#18309) * feat(route transform): Add option to enable/disable unmatched output This commit adds a new boolean option `reroute_unmatched` to the `route` transform. It is inspired on the `reroute_dropped` option in the `remap` transform, allowing the user to control if they want or not the `<transform_name>._unmatched` output to be created and used. For backwards compatibility, this new option defaults to `true`. Users that are not interested in processing unmatched events can use this option to avoid the following warning on Vector startup, and also to remove the unnecessary `_unmatched` output in `vector top`: ``` WARN vector::config::loading: Transform "route._unmatched" has no consumers ``` Signed-off-by: Hugo Hromic <hhromic@gmail.com> * Update existing `can_serialize_remap` test * Add test for the new `reroute_unmatched` option --------- Signed-off-by: Hugo Hromic <hhromic@gmail.com>
- Loading branch information
Showing
2 changed files
with
99 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 31 additions & 14 deletions
45
website/cue/reference/components/transforms/base/route.cue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,37 @@ | ||
package metadata | ||
|
||
base: components: transforms: route: configuration: route: { | ||
description: """ | ||
A table of route identifiers to logical conditions representing the filter of the route. | ||
base: components: transforms: route: configuration: { | ||
reroute_unmatched: { | ||
description: """ | ||
Reroutes unmatched events to a named output instead of silently discarding them. | ||
Each route can then be referenced as an input by other components with the name | ||
`<transform_name>.<route_id>`. If an event doesn’t match any route, it is sent to the | ||
`<transform_name>._unmatched` output. | ||
Normally, if an event doesn't match any defined route, it is sent to the `<transform_name>._unmatched` | ||
output for further processing. In some cases, you may want to simply discard unmatched events and not | ||
process them any further. | ||
Both `_unmatched`, as well as `_default`, are reserved output names and thus cannot be used | ||
as a route name. | ||
""" | ||
required: false | ||
type: object: options: "*": { | ||
description: "An individual route." | ||
required: true | ||
type: condition: {} | ||
In these cases, `reroute_unmatched` can be set to `false` to disable the `<transform_name>._unmatched` | ||
output and instead silently discard any unmatched events. | ||
""" | ||
required: false | ||
type: bool: default: true | ||
} | ||
route: { | ||
description: """ | ||
A table of route identifiers to logical conditions representing the filter of the route. | ||
Each route can then be referenced as an input by other components with the name | ||
`<transform_name>.<route_id>`. If an event doesn’t match any route, and if `reroute_unmatched` | ||
is set to `true` (the default), it is sent to the `<transform_name>._unmatched` output. | ||
Otherwise, the unmatched event is instead silently discarded. | ||
Both `_unmatched`, as well as `_default`, are reserved output names and thus cannot be used | ||
as a route name. | ||
""" | ||
required: false | ||
type: object: options: "*": { | ||
description: "An individual route." | ||
required: true | ||
type: condition: {} | ||
} | ||
} | ||
} |