This step-by-step guide will help you configure Vector to read and collect metrics from your sources using the Axiom sink.
Vector
Vector is a lightweight and ultra-fast tool for building observability pipelines. It has a built-in support for shipping logs to Axiom through the axiom
sink.
Follow the quickstart guide in the Vector documentation to install Vector, and to configure sources and sinks.
If you use Vector version v0.41.1 (released on September 11, 2024) 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.
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.
Send data to Axiom with Vector using the file
method and the axiom
sink.
The example below configures Vector to read and collect logs from files and send them to Axiom:
Create a vector configuration file vector.toml
with the following content:
In the code above, replace the following:
VECTOR_SOURCE_ID
with the Vector source ID.PATH_TO_LOGS
with the path to the log files. For example, /var/log/**/*.log
.SINK_ID
with the sink ID.Replace API_TOKEN
with the Axiom API token you have generated. For added security, store the API token in an environment variable.
Replace DATASET_NAME
with the name of the Axiom dataset where you want to send data.
Run Vector to send logs to Axiom.
The example below deletes a field before sending the data to Axiom:
FIELD_TO_REMOVE
with the field you want to remove.Replace API_TOKEN
with the Axiom API token you have generated. For added security, store the API token in an environment variable.
Replace DATASET_NAME
with the name of the Axiom dataset where you want to send data.
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, and we kindly ask you to inform us of the issue using the feedback tool at the bottom of this page.
Send Kubernetes logs to Axiom using the Kubernetes source.
Replace API_TOKEN
with the Axiom API token you have generated. For added security, store the API token in an environment variable.
Replace DATASET_NAME
with the name of the Axiom dataset where you want to send data.
To send Docker logs using the Axiom sink, you need to create a configuration file, for example, vector.toml
, with the following content:
Replace API_TOKEN
with the Axiom API token you have generated. For added security, store the API token in an environment variable.
Replace DATASET_NAME
with the name of the Axiom dataset where you want to send data.
Run Vector: Start Vector with the configuration file you just created:
Vector collects logs from Docker and forward them to Axiom using the Axiom sink. You can view and analyze your logs in your dataset.
To send AWS S3 logs using the Axiom sink, create a configuration file, for example, vector.toml
, with the following content:
Replace API_TOKEN
with the Axiom API token you have generated. For added security, store the API token in an environment variable.
Replace DATASET_NAME
with the name of the Axiom dataset where you want to send data.
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.
To send Kafka logs using the Axiom sink, you need to create a configuration file, for example, vector.toml
, with the following code:
Replace API_TOKEN
with the Axiom API token you have generated. For added security, store the API token in an environment variable.
Replace DATASET_NAME
with the name of the Axiom dataset where you want to send data.
Finally, you can start Vector with your configuration file: vector --config /path/to/your/vector.toml
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:
Configure NGINX to expose metrics. This typically involves enabling the ngx_http_stub_status_module
module in your NGINX configuration.
/etc/nginx/nginx.conf
) and in your server
block, add:This exposes basic NGINX metrics at the /metrics
endpoint on your server.
Configure Vector to scrape the NGINX metrics and send them to Axiom. Create a new configuration file (vector.toml
), and add the following:
Replace API_TOKEN
with the Axiom API token you have generated. For added security, store the API token in an environment variable.
Replace DATASET_NAME
with the name of the Axiom dataset where you want to send data.
Finally, you can start Vector with your configuration file: vector --config /path/to/your/vector.toml
To send Syslog logs using the Axiom sink, you need to create a configuration file, for example, vector.toml
, with the following code:
Replace API_TOKEN
with the Axiom API token you have generated. For added security, store the API token in an environment variable.
Replace DATASET_NAME
with the name of the Axiom dataset where you want to send data.
To send Prometheus scrape metrics using the Axiom sink, you need to create a configuration file, for example, vector.toml
, with the following code:
Replace API_TOKEN
with the Axiom API token you have generated. For added security, store the API token in an environment variable.
Replace DATASET_NAME
with the name of the Axiom dataset where you want to send data.
Check out the advanced configuration on Batch, Buffer configuration, and Encoding on Vector Documentation
If you use Vector version v0.41.1 (released on September 11, 2024) 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. 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
.
If you use Vector version v0.42.0 (released on October 21, 2024) or newer, use the _time
field as usual for other collectors.
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.
Example vrl
file:
Example Vector configuration file:
Upgrading to Vector version v0.42.0 or newer automatically enables the zstd
compression algorithm by default.
To set another compression algorithm, use the example below: