How Transforms Work
Transforms sit between sources and sinks in Vector’s topology: Each transform:- Receives events from one or more inputs (sources or other transforms)
- Processes events according to its configuration
- Emits results to one or more outputs (other transforms or sinks)
- Handles backpressure from downstream components
Transform Types
Parsing
Filtering
Routing
Enrichment
Aggregation
Conversion
Transform Categories
Parsing and Structuring
remap - Programmable transformation with VRL
remap - Programmable transformation with VRL
regex_parser - Extract fields with regex
regex_parser - Extract fields with regex
remap but simpler for basic parsing.grok_parser - Parse with Grok patterns
grok_parser - Parse with Grok patterns
Filtering and Sampling
filter - Keep or drop events
filter - Keep or drop events
sample - Reduce data volume
sample - Reduce data volume
dedupe - Remove duplicates
dedupe - Remove duplicates
Routing and Distribution
route - Send events to different outputs
route - Send events to different outputs
swimlanes - Parallel processing paths
swimlanes - Parallel processing paths
Enrichment and Context
remap with enrichment tables
remap with enrichment tables
lua - Custom logic with Lua
lua - Custom logic with Lua
remap) is preferred over Lua for better performance and type safety.Aggregation and Reduction
reduce - Merge events by key
reduce - Merge events by key
aggregate - Create metrics from logs
aggregate - Create metrics from logs
Type Conversion
log_to_metric - Extract metrics from logs
log_to_metric - Extract metrics from logs
metric_to_log - Convert metrics to logs
metric_to_log - Convert metrics to logs
Specialized Transforms
throttle
tag_cardinality_limit
throttle - Rate limiting
throttle - Rate limiting
tag_cardinality_limit - Protect metrics
tag_cardinality_limit - Protect metrics
Transform Behavior
Synchronous vs. Asynchronous
Synchronous transforms (e.g.,filter, remap):
- Process events immediately
- Maintain event order
- Support concurrent processing for performance
- Most common type
reduce, aggregate):
- Process events over time windows
- May reorder events
- Require internal state management
- Used for aggregation and stateful operations
Multiple Outputs
Some transforms support multiple named outputs:Vector Remap Language (VRL)
VRL is Vector’s purpose-built language for event transformation. It’s the recommended way to process events.VRL Features
- Type-safe: Compile-time type checking prevents runtime errors
- Fast: Compiled to efficient bytecode
- Ergonomic: Designed specifically for event processing
- Infallible: Fallible operations use
!to handle errors explicitly
Common VRL Patterns
VRL Error Handling
Performance Optimization
Transform Ordering
Order transforms to minimize processing:Concurrent Processing
Vector automatically enables concurrency for eligible transforms. To maximize performance:- Use
remapoverlua(VRL is faster and supports better concurrency) - Avoid stateful operations when possible
- Use
routeto split traffic before expensive operations
Memory Management
Best Practices
Transform early, route late
Transform early, route late
- Parse and structure data as early as possible
- Filter out unnecessary data before expensive operations
- Route to different destinations at the end of processing
Use VRL over Lua
Use VRL over Lua
- Type safety prevents runtime errors
- Better performance through compilation
- First-class support for Vector data types
- Interactive REPL for testing
Handle errors explicitly
Handle errors explicitly
Test transforms independently
Test transforms independently
Monitor transform performance
Monitor transform performance
component_received_events_totalcomponent_sent_events_totalcomponent_errors_totalcomponent_execution_time_seconds
Troubleshooting
Events Not Flowing
- Check transform condition logic
- Verify input references are correct
- Look for errors in VRL compilation
- Enable debug logging:
VECTOR_LOG=debug
High Memory Usage
- Reduce cache sizes in
dedupe - Decrease expiration times in
reduceandaggregate - Add
sampletransforms for high-volume data - Filter earlier in the pipeline
VRL Errors
Use the VRL REPL to debug:Related Topics
- VRL Reference - Complete VRL language documentation
- Data Model - Understanding event structure
- Pipeline Model - How transforms fit in topologies
- Sources - Where events come from
- Sinks - Where events go