Discard
Synopsis
Removes staged routes from the pipeline processing flow, either targeting a specific destination or discarding all staged routes at once.
Schema
- discard:
destination: <string>
target: <string>
description: <text>
if: <script>
ignore_failure: <boolean>
on_failure: <processor[]>
on_success: <processor[]>
tag: <string>
Configuration
| Field | Required | Default | Description |
|---|---|---|---|
destination | N | Destination route to remove from staged routes. Supports templating. If omitted, discards all staged routes. A template that comes out empty discards nothing. | |
target | N | Alias for destination field. | |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | See Handling Failures |
on_failure | N | - | See Handling Failures |
on_success | N | - | See Handling Success |
tag | N | - | Identifier |
disabled | N | false | When true, the processor is skipped and the event continues to the next one. Lets you take a processor out of the path without removing its configuration |
Details
The discard processor removes routes from the StagedRoutes map before they are committed to actual routing. This enables conditional route discarding based on data content or processing logic.
When destination is specified, the processor removes only that destination from staged routes. If the destination does not exist in staged routes, the processor returns an error unless ignore_failure is set to true.
When destination is not specified, the processor clears all staged routes from the map, preventing any staged routes from being committed.
The destination field supports template syntax, allowing dynamic destination selection based on log entry field values.
A destination that is set to a template that comes out empty discards nothing. It does not discard every staged route, as a discard without a destination does. This happens, for example, when a route leaves the setting that names a target blank because it has no such target. The other targets keep their staged copies.
A discard removes only the copy that is staged now. A later reroute to the same target can stage a new copy. To stop later reroutes to the target as well, follow the discard with a freeze on the same target.
A discard without a destination succeeds even when nothing is staged. A discard that names a destination can fail when nothing is staged for it, so set ignore_failure: true when the target may have no staged copy.
Examples
Discard Specific Destination
Staging multiple routes to different destinations... | |
Discarding only the sentinel route while preserving azdx... | |
Discard All Staged Routes
Staging routes for sentinel, azdx, and lake destinations... | |
Clearing all staged routes at once... | |
Conditional Discard
Log entry with discard decision field... | |
Route discarded when condition evaluates to true... | |
Templated Destination
Using log field value to determine which route to discard... | |
Template resolves to sentinel and removes that staged route... | |
Ignore Missing Destination
Attempting to discard non-existent destination with failure ignored... | |
Processor continues despite error, preserving original staged route... | |
Multiple Discard Operations
Complex staging scenario with selective discard and commit... | |
Final state shows only azdx committed, all others discarded... | |