Send logs, metrics, and traces to Zerobus Ingest with Vector
The databricks_zerobus sink is part of Vector, an open-source observability data pipeline. Vector classifies the sink as beta. For every sink option, see Vector's databricks_zerobus sink reference.
Maintained by: the Vector open-source project, in the vectordotdev/vector repository.
Vector collects, transforms, and routes logs, metrics, and traces. Its native databricks_zerobus sink writes Vector log events into a Unity Catalog Delta table through Zerobus Ingest, so you don't need to run a message bus or staging storage between Vector and the lakehouse. Vector's transforms run before the sink, so you can parse, filter, and reshape events with the Vector Remap Language (VRL) and store only the fields you want. Metrics and traces each get their own sink of the same type, after Vector turns them into log events.
Choose what to send
The databricks_zerobus sink accepts log events only. Logs need no conversion step. Metrics and traces each need one conversion step first, and each signal gets its own table and its own sink.
Signal | Path to the sink | Table |
|---|---|---|
Logs | Shape the fields with a | One table |
Metrics | Convert each data point with | One table |
Traces | Send them to a local | One table |
Start with logs. Add metrics and traces when your apps emit them.
When to use Vector
- You already run Vector as an agent or aggregator and want its data in Delta tables.
- Your apps emit OpenTelemetry (OTLP) logs, metrics, and traces, and you want each signal in its own table.
- You want to transform or filter events before they're stored.
How it works
- Interface: The sink is compiled into Vector and uses the Zerobus Ingest Rust SDK to send each batch as an Apache Arrow record batch over Arrow Flight. There's no plugin to install.
- Schema: At startup, the sink reads the target table's schema from Unity Catalog and encodes events to match it. You don't configure a schema in Vector.
- Field mapping: Top-level event fields map to table columns by name. A field with no matching column isn't sent. A column with no matching field is written as
NULL. - Types: Vector timestamps map to
TIMESTAMPcolumns, and values are written with the target column's type. - Authentication: The sink authenticates with a service principal's OAuth client ID and secret, and gets its own tokens.
- Delivery: The sink waits for Zerobus Ingest to acknowledge each batch as durable before it reports the batch as delivered. Each event is delivered one or more times, so a retried batch can produce duplicate rows. See Handle duplicates and restarts.
Requirements
- Vector 0.61.0 and above. Earlier releases with the
databricks_zerobussink (0.56.0 to 0.60.x) don't verify TLS certificates for OAuth and Unity Catalog requests. See the Vector 0.61.0 release notes. - Vector, installed with a package manager, the install script, or the
timberio/vectorcontainer image, as Vector's installation docs describe. - A workspace in a region that supports Zerobus Ingest. See Availability.
- A service principal with an OAuth secret. See Configure authentication. Note the service principal's application ID and client secret.
- Target tables that meet the Zerobus Ingest table requirements.
- Network access from the Vector host to your Zerobus Ingest endpoint and your workspace URL on port 443. The sink honors Vector's
proxysettings and theHTTPS_PROXYandNO_PROXYenvironment variables.
Step 1: Create the target table and grant access
Create a table whose columns match the fields of your log events after any Vector transforms. Keep columns nullable, which is the default. If the table declares a column NOT NULL and any event in a batch is missing that field, the sink drops the whole batch, including the valid events. To keep the valid events, see Send invalid events to a dead-letter sink.
The following table matches the configuration in Step 3:
CREATE TABLE <catalog>.<schema>.<table> (
event_id STRING,
timestamp TIMESTAMP,
service STRING,
severity STRING,
message STRING,
player STRING,
result INT,
trace_id STRING,
span_id STRING
);
Grant the service principal USE CATALOG on the catalog, USE SCHEMA on the schema, and MODIFY and SELECT on the table, as Configure authentication describes.
Step 2: Get your endpoints
The sink needs two URLs:
ingestion_endpoint: your Zerobus Ingest endpoint, with thehttps://prefix.unity_catalog_endpoint: your workspace URL. The sink uses it to get OAuth tokens and to read the table schema.
ingestion_endpoint:https://<workspace-id>.zerobus.<region>.gcp.databricks.comunity_catalog_endpoint:https://<workspace-url>
To find your workspace ID, region, and URL, see Get your workspace URL and Zerobus Ingest endpoint.
Step 3: Configure Vector
Since Vector 0.57.0, ${VAR} environment variable interpolation in configuration files is turned off by default, so a value like "${DATABRICKS_CLIENT_SECRET}" reaches the sink as literal text. Pass the credentials and endpoints through a Vector secrets backend instead. The following setup uses the exec backend: a small script that answers Vector's secret requests from environment variables.
Set the environment variables for the Vector process:
export ZEROBUS_SERVER_ENDPOINT="<ingestion-endpoint>" # the ingestion_endpoint from Step 2
export DATABRICKS_WORKSPACE_URL="https://<workspace-url>"
export DATABRICKS_CLIENT_ID="<service-principal-uuid>"
export DATABRICKS_CLIENT_SECRET="<client-secret>"
Save the following script as env-secrets.sh next to your configuration file and make it executable (chmod +x env-secrets.sh):
#!/bin/sh
# Vector `exec` secrets backend (protocol v1): answers from the container's environment.
# Vector 0.57.0 and later don't interpolate ${VAR} in config files by default, so the
# config reads these values as SECRET[env.<key>] instead.
# Vector writes {"version":"1.0","secrets":[...]} to stdin; we answer every known key.
cat >/dev/null
printf '{"zerobus_endpoint":{"value":"%s","error":null},"workspace_url":{"value":"%s","error":null},"client_id":{"value":"%s","error":null},"client_secret":{"value":"%s","error":null}}\n' \
"$ZEROBUS_SERVER_ENDPOINT" "$DATABRICKS_WORKSPACE_URL" "$DATABRICKS_CLIENT_ID" "$DATABRICKS_CLIENT_SECRET"
The following configuration receives OTLP data from apps instrumented with OpenTelemetry, shapes each log record to match the table from Step 1, and sends it to Zerobus Ingest. The example app is a small dice-roll service whose log records carry dice.player and dice.result attributes. For your own app, change the remap transform so its fields match your table's columns. Point your OpenTelemetry SDK or Collector at Vector's OTLP ports, 4317 for gRPC and 4318 for HTTP. Set command to the script's path.
data_dir: /var/lib/vector
secret:
env:
type: exec
command: [/etc/vector/env-secrets.sh]
sources:
otel:
type: opentelemetry
grpc: { address: 127.0.0.1:4317 }
http: { address: 127.0.0.1:4318 }
transforms:
shape_logs:
type: remap
inputs: [otel.logs]
source: |
. = {
"event_id": uuid_v4(),
"timestamp": .timestamp,
"service": .resources."service.name",
"severity": .severity_text,
"message": .message,
"player": .attributes."dice.player",
"result": to_int(.attributes."dice.result") ?? null,
"trace_id": .trace_id,
"span_id": .span_id
}
sinks:
dice_logs:
type: databricks_zerobus
inputs: [shape_logs]
ingestion_endpoint: 'SECRET[env.zerobus_endpoint]'
unity_catalog_endpoint: 'SECRET[env.workspace_url]'
table_name: <catalog>.<schema>.<table>
auth:
strategy: oauth
client_id: 'SECRET[env.client_id]'
client_secret: 'SECRET[env.client_secret]'
buffer:
type: disk
max_size: 268435488
The receivers listen only on the loopback interface, for apps on the same host. This example doesn't configure TLS or authentication for them. Any process on the host can send events, and every event they accept is written with the service principal's permissions.
Don't expose the receivers to other hosts. A firewall or network policy limits which hosts can reach ports 4317 and 4318, but it doesn't authenticate them. Any host it allows can write rows as the service principal.
To collect OTLP from apps on other hosts, run Vector on each of those hosts with the receivers on loopback.
The disk buffer keeps the events that have reached it across a crash. See Handle duplicates and restarts.
Step 4: Start Vector and verify
Validate the configuration. Vector also runs the sink's health check, which gets an OAuth token, reads the table's schema from Unity Catalog, and opens a stream to Zerobus Ingest:
vector validate vector.yaml
Start Vector:
vector --config vector.yaml
At startup, Vector logs Healthcheck passed. If the health check fails, Vector logs the error and keeps running. To exit instead, start Vector with --require-healthy.
Then query the table. The query returns the ten most recent log events, newest first, with each event's timestamp, severity, message, player, result, and trace ID.
SELECT timestamp, severity, message, player, result, trace_id
FROM <catalog>.<schema>.<table>
ORDER BY timestamp DESC
LIMIT 10;
Send metrics and traces
The sink accepts log events only. Vector rejects a configuration that connects metric or trace events to it, with Data type mismatch … (["Log"]). Turn each signal into log events first, then send it to its own table with its own sink.
Create a table for each signal:
CREATE TABLE <catalog>.<schema>.<metrics-table> (
event_id STRING,
timestamp TIMESTAMP,
service STRING,
metric STRING,
kind STRING,
value DOUBLE,
result STRING
);
CREATE TABLE <catalog>.<schema>.<traces-table> (
trace_id STRING,
span_id STRING,
parent_span_id STRING,
name STRING,
start_time TIMESTAMP,
end_time TIMESTAMP,
duration_ms DOUBLE,
service STRING,
player STRING,
result INT,
status_code INT
);
Grant the service principal MODIFY and SELECT on both, as in Step 1.
For metrics, the metric_to_log transform turns each metric data point into a log event, and a remap transform shapes it for the table:
transforms:
metrics_as_logs:
type: metric_to_log
inputs: [otel.metrics]
shape_metrics:
type: remap
inputs: [metrics_as_logs]
source: |
value = .counter.value
if value == null { value = .gauge.value }
. = {
"event_id": uuid_v4(),
"timestamp": .timestamp,
"service": .tags."resource.service.name",
"metric": .name,
"kind": .kind,
"value": value,
"result": .tags."dice.result"
}
sinks:
dice_metrics:
type: databricks_zerobus
inputs: [shape_metrics]
ingestion_endpoint: 'SECRET[env.zerobus_endpoint]'
unity_catalog_endpoint: 'SECRET[env.workspace_url]'
table_name: <catalog>.<schema>.<metrics-table>
auth:
strategy: oauth
client_id: 'SECRET[env.client_id]'
client_secret: 'SECRET[env.client_secret]'
buffer:
type: disk
max_size: 268435488
A cumulative counter, such as dice.rolls, arrives with kind set to absolute and the running total in value, labeled by its attributes (here result).
For traces, add an http sink that sends them to a local http_server source in the same Vector. That source receives them as log events, and a remap transform shapes each span for the table:
sources:
traces_as_logs:
type: http_server
address: 127.0.0.1:8687
decoding: { codec: json }
framing: { method: newline_delimited }
transforms:
shape_traces:
type: remap
inputs: [traces_as_logs]
source: |
parent = if .parent_span_id == "" { null } else { .parent_span_id }
start = parse_timestamp!(.start_time_unix_nano, "%+")
end = parse_timestamp!(.end_time_unix_nano, "%+")
dur_ns = (to_unix_timestamp(end, unit: "nanoseconds") - to_unix_timestamp(start, unit: "nanoseconds")) ?? 0
. = {
"trace_id": .trace_id,
"span_id": .span_id,
"parent_span_id": parent,
"name": .name,
"start_time": start,
"end_time": end,
"duration_ms": to_float(dur_ns) / 1000000.0,
"service": .resources."service.name",
"player": .attributes."dice.player",
"result": to_int(.attributes."dice.result") ?? null,
"status_code": .status.code
}
sinks:
traces_to_logs:
type: http
inputs: [otel.traces]
uri: http://127.0.0.1:8687/
encoding: { codec: json }
framing: { method: newline_delimited }
dice_traces:
type: databricks_zerobus
inputs: [shape_traces]
ingestion_endpoint: 'SECRET[env.zerobus_endpoint]'
unity_catalog_endpoint: 'SECRET[env.workspace_url]'
table_name: <catalog>.<schema>.<traces-table>
auth:
strategy: oauth
client_id: 'SECRET[env.client_id]'
client_secret: 'SECRET[env.client_secret]'
buffer:
type: disk
max_size: 268435488
The http_server source listens on 127.0.0.1, so the loop stays inside the host. Log records and their spans share trace_id and span_id, so you can join the two tables.
Send invalid events to a dead-letter sink
One event that doesn't fit the table, such as an event missing a NOT NULL column, makes the sink drop its whole batch. The error isn't retried. To keep the valid events, check required fields in a remap transform and route events that fail to a separate sink.
The following configuration is the dead-letter example from the Vector Zerobus example. It reads JSON lines from a file and checks that each event has a non-null event_id before it reaches Zerobus Ingest. Events without one, and lines that aren't valid JSON, are rerouted to the dead_letter sink, which prints them as JSON. Replace console with a durable sink, such as file, to keep them for reprocessing.
# Dead-letter test: reads tests/bad-records.jsonl, sends events with an event_id to the
# table, and prints the rest (no event_id, a null event_id, or a line that isn't JSON)
# to the console instead of failing the batch.
data_dir: /tmp
secret:
env:
type: exec
command: [/etc/vector/env-secrets.sh]
sources:
bad_input:
type: file
include: [/etc/vector-tests/bad-records.jsonl]
read_from: beginning
data_dir: /tmp
transforms:
parse_json:
type: remap
inputs: [bad_input]
source: |
. = parse_json!(.message)
if exists(.timestamp) { .timestamp = parse_timestamp!(.timestamp, "%+") }
if !exists(.event_id) || .event_id == null { abort }
drop_on_abort: true
drop_on_error: true
reroute_dropped: true
sinks:
dead_letter:
type: console
inputs: [parse_json.dropped]
encoding:
codec: json
zerobus:
type: databricks_zerobus
inputs: [parse_json]
ingestion_endpoint: 'SECRET[env.zerobus_endpoint]'
unity_catalog_endpoint: 'SECRET[env.workspace_url]'
table_name: <catalog>.<schema>.<table>
auth:
strategy: oauth
client_id: 'SECRET[env.client_id]'
client_secret: 'SECRET[env.client_secret]'
A rerouted event carries metadata.dropped.reason: abort for an event that fails the event_id check, and error for a line that parse_json! can't parse. Without drop_on_error: true, a line that fails to parse passes through unchanged and lands as a row that is mostly NULL.
Handle duplicates and restarts
Each event is delivered one or more times. If Zerobus Ingest doesn't acknowledge a batch, for example because a connection fails first, Vector retries it, which can write the same events twice. See Delivery guarantees.
To deduplicate, give each event an ID before it reaches the sink, as the event_id field does in Step 3. A retried batch resends the same events with the same IDs, so you can remove duplicates downstream, for example with a MERGE on event_id or a ROW_NUMBER() window in a view.
When Vector stops gracefully, such as on SIGTERM, it sends the events it holds before it exits. When the process receives SIGKILL or crashes, events in the default in-memory buffer are lost. The configuration in Step 3 uses a disk buffer (buffer.type: disk with max_size: 268435488, under data_dir), so events that Vector has already written to the buffer survive a crash. Events that are still in flight from your app when Vector stops can be lost, because the app's exporter can't deliver them.
Troubleshooting
Symptom | Cause | Fix |
|---|---|---|
|
| Pass values through a secrets backend, as in Step 3. |
Health check fails with |
| Set |
Logs show | The table declares that column | Make the column nullable, set the field on every event in your |
Rows arrive, but some columns stay | Event field names don't match the column names, so those fields aren't sent | Rename the fields in your |
Size errors from the Zerobus Ingest SDK | Vector sizes batches before Arrow encoding. Numeric-heavy schemas can encode larger than the source event, so a batch can exceed the SDK's 10 MB limit. | Lower |
| The sink accepts log events only | Turn metrics and traces into log events first. See Send metrics and traces. |
Your app logs | The OpenTelemetry exporter can't reach Vector, for example during a Vector restart | The exporter retries with backoff and resumes after a short outage. Events in flight when Vector stops can be lost. |
A warning at startup: | The SDK sets this header itself | No action needed. The warning is harmless. |
Connection errors behind a proxy | The proxy isn't configured for Vector | Set Vector's |
Additional resources
- Vector Zerobus example: a runnable dice-roll app that sends logs, metrics, and traces through Vector into three Delta tables.
- Schema management: plan table schema changes.
- Use Arrow Flight with Zerobus Ingest: the Arrow Flight path that this sink uses.
- Vector
databricks_zerobussink reference: every sink option.