Skip to content

Commit 4675681

Browse files
committed
better vector docs
1 parent 220b107 commit 4675681

File tree

1 file changed

+55
-27
lines changed

1 file changed

+55
-27
lines changed

docs/product/drains/integration/vector.mdx

Lines changed: 55 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,11 @@ description: Learn how to set up Vector to forward logs to Sentry via OpenTeleme
66

77
You can configure [Vector](https://vector.dev/) to forward logs to Sentry using its [OpenTelemetry sink](https://vector.dev/docs/reference/configuration/sinks/opentelemetry/).
88

9-
<Alert level="warning">
10-
11-
Vector's OpenTelemetry sink requires events to conform to the [OTEL proto format](https://opentelemetry.io/docs/specs/otlp/). You must use the [remap transform](https://vector.dev/docs/reference/configuration/transforms/remap/) with VRL (Vector Remap Language) to convert your log data into the proper OpenTelemetry structure before sending to Sentry.
12-
13-
</Alert>
14-
159
## Prerequisites
1610

1711
Before you begin, ensure you have:
1812

19-
- Vector installed and running
13+
- Vector installed and running (version 0.51.0 or higher for `otlp` codec support)
2014
- A Sentry project you want to send data to
2115

2216
## Step 1: Get Your Sentry OTLP Credentials
@@ -37,15 +31,53 @@ x-sentry-auth: sentry sentry_key=___PUBLIC_KEY___
3731

3832
## Step 2: Configure Vector
3933

40-
Vector configuration requires three components:
34+
Choose your configuration based on your data source:
4135

42-
1. **Source**: Where your logs come from (files, syslog, etc.)
43-
2. **Transform**: A remap transform to convert logs to OTEL format
44-
3. **Sink**: The OpenTelemetry sink to send data to Sentry
36+
- **Option A**: Forwarding existing OTLP data (simplest)
37+
- **Option B**: Transforming non-OTLP data (files, syslog, etc.)
38+
39+
## Option A: Forwarding OTLP Data
40+
41+
If you're receiving data that's already in OTLP format (from an OpenTelemetry SDK or collector), you can forward it directly to Sentry using the `otlp` codec without any transformation.
42+
43+
```yaml {filename:vector.yaml}
44+
sources:
45+
otel_source:
46+
type: opentelemetry
47+
grpc:
48+
address: 0.0.0.0:4317
49+
http:
50+
address: 0.0.0.0:4318
51+
use_otlp_decoding: true
52+
53+
sinks:
54+
sentry_logs:
55+
inputs:
56+
- otel_source.logs
57+
type: opentelemetry
58+
protocol:
59+
type: http
60+
uri: ___OTLP_LOGS_URL___
61+
method: post
62+
headers:
63+
x-sentry-auth: "sentry sentry_key=___PUBLIC_KEY___"
64+
encoding:
65+
codec: otlp
66+
```
67+
68+
<Alert level="info">
69+
70+
The `otlp` codec requires Vector version [0.51.0](https://vector.dev/releases/0.51.0/) or higher. The `use_otlp_decoding` option was introduced in Vector [0.50.0](https://vector.dev/releases/0.50.0/).
71+
72+
</Alert>
73+
74+
## Option B: Transforming Non-OTLP Data
75+
76+
If your logs come from non-OTLP sources (files, syslog, etc.), you need to use a [remap transform](https://vector.dev/docs/reference/configuration/transforms/remap/) with VRL (Vector Remap Language) to convert your data into the OTEL format before sending to Sentry.
4577

4678
### Understanding the OTEL Log Format
4779

48-
The OpenTelemetry log format requires a specific structure with `resourceLogs`, `scopeLogs`, and `logRecords`. Here's the structure you need to create:
80+
The OpenTelemetry log format requires a specific structure with `resourceLogs`, `scopeLogs`, and `logRecords`:
4981

5082
```json
5183
{
@@ -74,7 +106,7 @@ The OpenTelemetry log format requires a specific structure with `resourceLogs`,
74106
}
75107
```
76108

77-
## Example: Forwarding File Logs
109+
### Example: Forwarding File Logs
78110

79111
Here's a complete example that reads logs from a file and forwards them to Sentry:
80112

@@ -134,14 +166,11 @@ sinks:
134166
method: post
135167
headers:
136168
x-sentry-auth: "sentry sentry_key=___PUBLIC_KEY___"
137-
content-type: "application/json"
138169
encoding:
139-
codec: json
140-
framing:
141-
method: newline_delimited
170+
codec: otlp
142171
```
143172

144-
## Example: Forwarding Syslog
173+
### Example: Forwarding Syslog
145174

146175
For syslog data, you can map severity levels to OTEL severity:
147176

@@ -218,11 +247,8 @@ sinks:
218247
method: post
219248
headers:
220249
x-sentry-auth: "sentry sentry_key=___PUBLIC_KEY___"
221-
content-type: "application/json"
222250
encoding:
223-
codec: json
224-
framing:
225-
method: newline_delimited
251+
codec: otlp
226252
```
227253

228254
## VRL Remap Reference
@@ -247,7 +273,7 @@ Here are the key VRL functions you'll use when building OTEL log records:
247273
| `protocol.type` | Transport protocol (`http`) | Yes |
248274
| `protocol.uri` | Your Sentry OTLP logs endpoint | Yes |
249275
| `protocol.headers` | HTTP headers including authentication | Yes |
250-
| `protocol.encoding.codec` | Encoding format (`json`) | Yes |
276+
| `protocol.encoding.codec` | Must be `otlp` for OpenTelemetry encoding | Yes |
251277

252278
### OTEL Log Record Fields
253279

@@ -262,16 +288,18 @@ Here are the key VRL functions you'll use when building OTEL log records:
262288

263289
### Logs Not Appearing in Sentry
264290

265-
1. **Check the OTEL structure**: Ensure your remap transform creates the correct `resourceLogs` structure with all required nested fields.
291+
1. **Check Vector version**: The `otlp` codec requires Vector 0.51.0+. Run `vector --version` to verify.
292+
293+
2. **Check the OTEL structure**: If using remap, ensure your transform creates the correct `resourceLogs` structure with all required nested fields.
266294

267-
2. **Verify timestamps**: The `timeUnixNano` field must be a valid Unix timestamp in nanoseconds.
295+
3. **Verify timestamps**: The `timeUnixNano` field must be a valid Unix timestamp in nanoseconds.
268296

269-
3. **Enable Vector debug logging**: Run Vector with debug logging to see the transformed events:
297+
4. **Enable Vector debug logging**: Run Vector with debug logging to see the transformed events:
270298

271299
```bash
272300
VECTOR_LOG=debug vector --config /path/to/vector.yaml
273301
```
274302

275-
4. **Validate your VRL**: Use [Vector's VRL playground](https://playground.vrl.dev/) to test your remap logic.
303+
5. **Validate your VRL**: Use [Vector's VRL playground](https://playground.vrl.dev/) to test your remap logic.
276304

277305
For more information on Vector configuration options, see the [Vector documentation](https://vector.dev/docs/reference/configuration/).

0 commit comments

Comments
 (0)