What is VRL?
Vector Remap Language (VRL) is an expression-oriented, domain-specific language designed specifically for transforming observability data (logs, metrics, and traces) within Vector. VRL provides a safe, performant, and intuitive way to manipulate your data pipeline events.Key Characteristics
Expression-Oriented
VRL is fundamentally expression-oriented - every statement in VRL is an expression that returns a value. This makes the language predictable and composable:Type Safety
VRL includes compile-time type checking to catch errors before your pipeline runs. The compiler analyzes your VRL programs and ensures type compatibility:Safety First
VRL is designed with safety as a core principle:- Fail-safe: Programs won’t crash your pipeline
- Memory safe: Built on Rust’s memory safety guarantees
- Ergonomic error handling: Explicit handling of fallible operations
- No infinite loops: No unbounded iteration constructs
High Performance
VRL is compiled to efficient bytecode and optimized for observability workloads:- Compiled ahead of time for each transform
- Zero-copy operations where possible
- Optimized for event transformation patterns
- Minimal runtime overhead
Core Concepts
Events
VRL programs operate on a single event at a time. An event is represented by the special. (dot) variable, which refers to the current event being processed:
Paths
Paths are used to access and modify fields within events. They use dot notation for object fields and bracket notation for array elements:Variables
Variables store intermediate values and are scoped to the VRL program:Fallibility
Many operations in VRL are fallible - they can succeed or fail. VRL requires explicit handling of failures:VRL Type System
VRL supports the following types:- string: UTF-8 encoded text (
"hello",s'raw string') - integer: Whole numbers (
42,-100) - float: Floating-point numbers (
3.14,-0.5) - boolean: True or false (
true,false) - timestamp: RFC 3339 timestamps (
t'2021-03-01T19:00:00Z') - null: Null value (
null) - array: Ordered collection (
[1, 2, 3]) - object: Key-value map (
{"key": "value"}) - regex: Regular expression (compiled at compile-time)
Where VRL is Used
VRL is primarily used in Vector through:Remap Transform
Theremap transform is where most VRL programs execute. It allows you to transform events:
Filter Transform
VRL expressions create conditions for filtering events:Route Transform
VRL expressions route events to different outputs:Language Features
Compilation
VRL programs are compiled when Vector starts, catching errors before processing any events:- Syntax errors detected immediately
- Type errors caught at compile time
- Undefined function/field warnings
- Performance optimizations applied
Error Handling
VRL provides multiple ways to handle errors:String Interpolation
VRL supports template strings with variable interpolation:Iteration Support
VRL provides functions for iterating over collections:Control Flow
VRL supports conditional logic:Why VRL?
Purpose-Built for Observability
VRL is designed specifically for observability data transformation:- Built-in functions for common log/metric operations
- Native support for parsing formats (JSON, syslog, CEF, etc.)
- Optimized for high-throughput data pipelines
- Understanding of observability data types
Alternative to General-Purpose Languages
Unlike embedding Lua, JavaScript, or Python:- Faster: Compiled and optimized for event transformation
- Safer: No segfaults, memory leaks, or crashes
- Simpler: Domain-specific operations built-in
- Predictable: No hidden costs or unbounded operations
Production Ready
VRL is battle-tested in production environments:- Used by thousands of Vector deployments
- Handles millions of events per second
- Comprehensive test suite
- Extensive real-world validation
Getting Started
To start using VRL:- Try the VRL REPL: Run
vector vrlto experiment with VRL interactively - Use the online playground: Visit playground.vrl.dev
- Read the function reference: Explore the 200+ built-in functions
- Study examples: See real-world VRL programs in action
Learn More
- VRL Functions Reference - Complete list of built-in functions
- VRL Expressions - Syntax and operators
- VRL Examples - Real-world transformation examples
- Remap Transform - Using VRL in Vector configuration
Additional Resources
- VRL Playground: playground.vrl.dev - Test VRL online
- Vector Blog: VRL Announcement Post
- GitHub: Vector source code
- Discord: Join the Vector community for VRL help
Next Steps
Now that you understand VRL basics, explore:- Function categories: String, Parse, Coerce, Encode, Array, Object manipulation
- Error handling patterns: Graceful degradation and fallback strategies
- Performance optimization: Writing efficient VRL programs
- Testing strategies: Validating VRL programs before deployment