Skip to content

Commit e540ee7

Browse files
darachmanototh
andauthored
Add docs to cover vector axiom sink changes and migration (#114)
Signed-off-by: Darach Ennis <[email protected]> Co-authored-by: Mano Toth <[email protected]> Co-authored-by: Mano Toth <[email protected]>
1 parent 0f4ce79 commit e540ee7

File tree

1 file changed

+79
-12
lines changed

1 file changed

+79
-12
lines changed

send-data/vector.mdx

Lines changed: 79 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ Vector is a lightweight and ultra-fast tool for building observability pipelines
1616

1717
Follow the [quickstart guide in the Vector documentation](https://vector.dev/docs/setup/quickstart/) to install Vector, and to configure sources and sinks.
1818

19-
## timestamp field
19+
<Warning>
20+
If you use Vector version v0.41.1 or earlier, use the `@timestamp` field instead of `_time` to specify the timestamp of the events. For more information, see [Timestamp in legacy Vector versions](#timestamp-in-legacy-vector-versions).
2021

21-
Logs and metrics sent via vector should use `@timestamp` as the timestamp field like: `{"@timestamp":"2022-04-14T21:30:30.658Z..."}`, not `_time`. Axiom accepts many date strings and timestamps without knowing the format in advance, including Unix Epoch, RFC3339, and ISO 8601.
22+
If you upgrade from Vector version v0.41.1 or earlier to a newer version, update your configuration. For more information, see [Upgrade from legacy Vector version](#upgrade-from-legacy-vector-version).
23+
</Warning>
2224

2325
## Configuration
2426

@@ -65,6 +67,7 @@ type = "remap"
6567
inputs = ["VECTOR_SOURCE_ID"]
6668
source = '''
6769
. = del(.FIELD_TO_REMOVE)
70+
'''
6871

6972
[sinks.SINK_ID]
7073
type = "axiom"
@@ -79,7 +82,7 @@ Replace `FIELD_TO_REMOVE` with the field you want to remove.
7982
Any changes to Vector’s `file` method can make the code example above outdated. If this happens, please refer to the [official Vector documentation on the `file` method](https://vector.dev/docs/reference/configuration/sources/file/), and we kindly ask you to inform us of the issue using the feedback tool at the bottom of this page.
8083
</Note>
8184

82-
## Send Kubernetes logs to Axiom
85+
## Send Kubernetes logs to Axiom
8386

8487
Send Kubernetes logs to Axiom using the Kubernetes source.
8588

@@ -117,7 +120,7 @@ TOKEN is used to ingest or query data to your dataset. API token can be generate
117120

118121
[See creating an API token for more](/reference/tokens)
119122

120-
## Send Docker logs to Axiom
123+
## Send Docker logs to Axiom
121124

122125
To send Docker logs using the Axiom sink, you need to create a configuration file, for example, `vector.toml`, with the following content:
123126

@@ -145,7 +148,7 @@ vector --config /path/to/vector.toml
145148

146149
Vector collects logs from Docker and forward them to Axiom using the Axiom sink. You can view and analyze your logs in your dataset.
147150

148-
## Send AWS S3 logs to Axiom
151+
## Send AWS S3 logs to Axiom
149152

150153
To send AWS S3 logs using the Axiom sink, create a configuration file, for example, `vector.toml`, with the following content:
151154

@@ -155,7 +158,6 @@ type = "aws_s3"
155158
bucket = "my-bucket" # replace with your bucket name
156159
region = "us-west-2" # replace with the AWS region of your bucket
157160

158-
159161
[sinks.axiom]
160162
type = "axiom"
161163
inputs = ["my_s3_source"]
@@ -165,7 +167,7 @@ token = "your_api_token" # replace with your Axiom API token
165167

166168
Finally, run Vector with the configuration file using `vector --config ./vector.toml`. This starts Vector and begins reading logs from the specified S3 bucket and sending them to the specified Axiom dataset.
167169

168-
## Send Kafka logs to Axiom
170+
## Send Kafka logs to Axiom
169171

170172
To send Kafka logs using the Axiom sink, you need to create a configuration file, for example, `vector.toml`, with the following code:
171173

@@ -186,7 +188,7 @@ token = "your_api_token" # replace with your Axiom API token
186188

187189
Finally, you can start Vector with your configuration file: `vector --config /path/to/your/vector.toml`
188190

189-
## Send NGINX metrics to Axiom
191+
## Send NGINX metrics to Axiom
190192

191193
To send NGINX metrics using Vector to the Axiom sink, first enable NGINX to emit metrics, then use Vector to capture and forward those metrics. Here is a step-by-step guide:
192194

@@ -230,7 +232,7 @@ token = "your_api_token" # replace with your Axiom API token
230232

231233
Finally, you can start Vector with your configuration file: `vector --config /path/to/your/vector.toml`
232234

233-
## Send Syslog logs to Axiom
235+
## Send Syslog logs to Axiom
234236

235237
To send Syslog logs using the Axiom sink, you need to create a configuration file, for example, `vector.toml`, with the following code:
236238

@@ -244,11 +246,11 @@ mode="tcp"
244246
[sinks.axiom]
245247
type="axiom"
246248
inputs = [ "my_source_id" ] # required
247-
dataset="your_dataset_name" # replace with the name of your Axiom dataset
249+
dataset="your_dataset_name" # replace with the name of your Axiom dataset
248250
token="your_api_token" # replace with your Axiom API token
249251
```
250252

251-
## Send Prometheus metrics to Axiom
253+
## Send Prometheus metrics to Axiom
252254

253255
To send Prometheus scrape metrics using the Axiom sink, you need to create a configuration file, for example, `vector.toml`, with the following code:
254256

@@ -266,4 +268,69 @@ dataset = "your_prometheus_dataset" # replace with the name of your Axiom datas
266268
token = "your_api_token" # replace with your Axiom API token
267269
```
268270

269-
Check out the [advanced configuration on Batch, Buffer configuration, and Encoding on Vector Documentation](https://vector.dev/docs/reference/configuration/sinks/axiom/)
271+
Check out the [advanced configuration on Batch, Buffer configuration, and Encoding on Vector Documentation](https://vector.dev/docs/reference/configuration/sinks/axiom/)
272+
273+
## Timestamp in legacy Vector versions
274+
275+
If you use Vector version v0.41.1 or earlier, use the `@timestamp` field instead of `_time` to specify the timestamp in the event data you send to Axiom. For example: `{"@timestamp":"2022-04-14T21:30:30.658Z..."}`. For more information, see [Requirements of the timestamp field](/reference/field-restrictions#requirements-of-the-timestamp-field). In the case of Vector version v0.41.1 or earlier, the requirements explained on the page apply to the `@timestamp` field, not to `_time`.
276+
277+
If you use Vector version v0.42.0 or newer, use the `_time` field as usual for other collectors.
278+
279+
### Upgrade from legacy Vector version
280+
281+
If you upgrade from Vector version v0.41.1 or earlier to a newer version, change all references from the `timestamp` field to the `_time` field and remap the logic.
282+
283+
Example `vrl` file:
284+
285+
```vrl example.vrl
286+
# Set time explicitly rather than allowing Axiom to default to the current time
287+
. = set!(value: ., path: ["_time"], data: .timestamp)
288+
289+
# Remove the original value as it is effectively a duplicate
290+
del(.timestamp)
291+
```
292+
293+
Example Vector configuration file:
294+
295+
```toml
296+
# ...
297+
298+
[transforms.migrate]
299+
type = "remap"
300+
inputs = [ "k8s"]
301+
file= 'example.vrl' # See above
302+
303+
[sinks.debug]
304+
type = "axiom"
305+
inputs = [ "migrate" ]
306+
dataset = "my-axiom-dataset" # No change
307+
token = "your-token" # No change
308+
309+
[sinks.debug.encoding]
310+
codec = "json"
311+
```
312+
313+
### Set compression algorithm
314+
315+
Upgrading to Vector version v0.42.0 or newer automatically enables the `zstd` compression algorithm by default.
316+
317+
To set another compression algorithm, use the example below:
318+
319+
```toml
320+
# ...
321+
322+
[transforms.migrate]
323+
type = "remap"
324+
inputs = [ "k8s"]
325+
file= 'example.vrl' # See above
326+
327+
[sinks.debug]
328+
type = "axiom"
329+
compression = "gzip" # Set the compression algorithm
330+
inputs = [ "migrate" ]
331+
dataset = "my-axiom-dataset" # No change
332+
token = "your-token" # No change
333+
334+
[sinks.debug.encoding]
335+
codec = "json"
336+
```

0 commit comments

Comments
 (0)