vector-vrl
Vector's own VRL compiler and runtime, compiled into a Python extension. The real VRL engine from Vector, self contained - no binary to install, nothing to shell out to.
pip install vector-vrl
from vector_vrl import execute_vrl, validate_vrl
vrl = """
parsed, err = parse_json(.message)
if err == null {
.level = parsed.level
}
"""
execute_vrl(vrl, ['{"message": "{\\"level\\": \\"info\\"}"}'])
# [{'level': 'info', 'message': '{"level": "info"}'}]
validate_vrl(vrl).success
# True
What it is good for
- Test VRL in CI without installing Vector.
validate_vrlcompiles without running, so a broken transform fails your test suite instead of your pipeline. - Check a Vector config before you ship it.
validate_configwalks a YAML/TOML/JSON config and compiles everyremaptransform's VRL, catching the most common way a config breaks. It checks the VRL, not the sinks - see the caveat under The API. - Build VRL tooling - playgrounds, linters, editor plugins, config generators - against the real compiler rather than a regex approximation.
- Process events in Python with semantics identical to what your Vector deployment will do to the same data.
- AI agents for VRL processing and development loops - generate a candidate, compile it, run it, iterate, all without a Vector install.
Safer to hand untrusted VRL
Two guards apply to every entry point that compiles VRL:
- No host, no network.
get_env_var,get_hostname,http_request,dns_lookupand six more are not compiled in. Caller-supplied VRL cannot read your environment or reach out of the process - it fails to compile instead. This is what the published wheel ships. Someone building the crate from source can turn those ten functions on with thefull-stdlibCargo feature; only do that where you control the VRL text. - No nesting bomb. VRL source may not nest brackets past 64 levels. Past
a few hundred the parser's own recursion overflows the stack and kills the
process, which no Python
exceptcan catch, so the check runs before the parser ever sees the input. There is no way to switch this one off.
That combination is what makes it reasonable to accept VRL from a user - a multi-tenant playground, a customer-supplied transform, a config someone pasted in. The reasoning is in docs/architecture.md.
The API
execute_vrl(vrl, events, secrets=None) |
Compile once, run over a batch, get the transformed events back |
execute_vrl_with_secrets(vrl, events, secrets=None) |
The same run, but each entry carries the event's secret store as well |
validate_vrl(vrl) |
Compile without running. Returns a VrlResult, never raises on bad VRL |
get_vrl_performance(vrl, events, iterations=100) |
Run it repeatedly, get events/sec |
Vector |
Batch runner holding state across calls - .initialize(), .process_logs(), .get_stats() |
validate_config(path|dict) |
Compile every remap transform's VRL in a Vector config (YAML/TOML/JSON), in-process |
validate_config_with_vector(path) |
Full config check by running vector validate - needs the binary, never a daemon |
Vector runs the VRL step alone. Its config argument is stored but never
applied - there is no sources/transforms/sinks pipeline here. If you want the
full pipeline, run Vector itself.
Checking a Vector config
There are two levels, and the difference matters.
validate_config is in-process and needs no vector binary. It compiles the
source of every remap transform and reports each by name. It says nothing
about sources, sinks or wiring, and it cannot judge VRL that calls
get_enrichment_table_record or get_secret - those are registered by Vector
from enrichment_tables: and secret backends declared in the config, outside
VRL, so this build has never heard of them. Rather than call a valid config
broken, it reports those transforms as unchecked with a reason. Reading a
YAML config needs pip install vector-vrl[yaml]; TOML and JSON need nothing.
validate_config_with_vector runs vector validate --no-environment and
checks the lot - wiring, component options, and the enrichment-backed VRL the
in-process check has to skip. It needs Vector installed, and it is one-shot:
Vector exits as soon as it has answered, never running as a daemon and never
moving data.
Exact signatures, return shapes, and the rough edges worth knowing (nested objects come back as JSON strings, a per-event runtime error replaces that event's dict) are in docs/reference-python-api.md.
Contributing
See CONTRIBUTING.md.
License
Apache License, Version 2.0. See LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vector_vrl-1.0.7-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: vector_vrl-1.0.7-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 5.4 MB
- Tags: CPython 3.12+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64a0bb497d79ecf4e9834c71295dec79904812f5153b27b7fe6567fd7a7fe739
|
|
| MD5 |
98bbb9b538033d7905ce39b19f80d38a
|
|
| BLAKE2b-256 |
f6df693f2e33a494dff450e98208671df70f49aa153f87667636c1582de15d72
|
File details
Details for the file vector_vrl-1.0.7-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: vector_vrl-1.0.7-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 5.4 MB
- Tags: CPython 3.12+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
128bfd330a2c942a6824817e866262e6c6fa93ce51051708641e878acd0e0421
|
|
| MD5 |
72d0f8616ef6181ed44742d0ea18bf25
|
|
| BLAKE2b-256 |
60c289d78e44b82f57997a9a20a0525279eea86765b3527d559b447d46d77a32
|
File details
Details for the file vector_vrl-1.0.7-cp312-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: vector_vrl-1.0.7-cp312-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 4.7 MB
- Tags: CPython 3.12+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7be0597bfb35dda71776a13cb5357c967ccfda17da566a126946f7614435c34
|
|
| MD5 |
8e41bcc6c66dd091d599c8078ef7d2d2
|
|
| BLAKE2b-256 |
4a1f22ff5c6779f5c9c6686b33749406eed3cc5068289791bd3661570eb92039
|
File details
Details for the file vector_vrl-1.0.7-cp312-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: vector_vrl-1.0.7-cp312-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 5.0 MB
- Tags: CPython 3.12+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62872fe319c4577c8934cb7e68607d6b67a4c41189c9e459bc58c3dc9dcb4b56
|
|
| MD5 |
7b7267e13c14db805b385206a774e8a5
|
|
| BLAKE2b-256 |
b1da2c2db8d495388efc06e28eb11b017c50620fbcd912187c7fcf2b914bc4ca
|