This page explains how to configure Vector to read and collect metrics from your sources using the Axiom sink.
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.
To send AWS S3 logs using the Axiom sink, create a configuration file, for example, vector.toml, with the following content:
TOML
[sources.my_s3_source]type = "aws_s3"bucket = "my-bucket" # replace with your bucket nameregion = "us-west-2" # replace with the AWS region of your bucket[sinks.axiom]type = "axiom"inputs = ["my_s3_source"]dataset = "DATASET_NAME"token = "API_TOKEN"region = "AXIOM_DOMAIN"
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:
TOML
[sources.my_kafka_source]type = "kafka" # must be: kafkabootstrap_servers = "10.14.22.123:9092" # your Kafka bootstrap serversgroup_id = "my_group_id" # your Kafka consumer group IDtopics = ["my_topic"] # the Kafka topics to consume fromauto_offset_reset = "earliest" # start reading from the beginning[sinks.axiom]type = "axiom"inputs = ["my_kafka_source"] # connect the Axiom sink to your Kafka sourcedataset = "DATASET_NAME" # replace with the name of your Axiom datasettoken = "API_TOKEN" # replace with your Axiom API tokenregion = "AXIOM_DOMAIN"
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 Vector to scrape the NGINX metrics and send them to Axiom. Create a new configuration file (vector.toml), and add the following:
TOML
[sources.nginx_metrics]type = "nginx_metrics" # must be: nginx_metricsendpoints = ["http://localhost/metrics"] # the endpoint where NGINX metrics are exposed[sinks.axiom]type = "axiom" # must be: axiominputs = ["nginx_metrics"] # use the metrics from the NGINX sourcedataset = "DATASET_NAME" # replace with the name of your Axiom datasettoken = "API_TOKEN" # replace with your Axiom API tokenregion = "AXIOM_DOMAIN"
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:
TOML
[sources.my_source_id]type="syslog"address="0.0.0.0:6514"max_length=102_400mode="tcp"[sinks.axiom]type="axiom"inputs = [ "my_source_id" ] # requireddataset="DATASET_NAME" # replace with the name of your Axiom datasettoken="API_TOKEN" # replace with your Axiom API tokenregion = "AXIOM_DOMAIN"
To send Prometheus scrape metrics using the Axiom sink, you need to create a configuration file, for example, vector.toml, with the following code:
TOML
# Define the Prometheus source that scrapes metrics[sources.my_prometheus_source]type = "prometheus_scrape" # scrape metrics from a Prometheus endpointendpoints = ["http://localhost:9090/metrics"] # replace with your Prometheus endpoint# Define Axiom sink where logs will be sent[sinks.axiom]type = "axiom" # Axiom typeinputs = ["my_prometheus_source"] # connect the Axiom sink to your Prometheus sourcedataset = "DATASET_NAME" # replace with the name of your Axiom datasettoken = "API_TOKEN" # replace with your Axiom API tokenregion = "AXIOM_DOMAIN"
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:
text
# Set time explicitly rather than allowing Axiom to default to the current time. = set!(value: ., path: ["_time"], data: .timestamp)# Remove the original value as it’s effectively a duplicatedel(.timestamp)