Docs
DocumentationQuery ReferenceAPI Reference
Open Console→→
DocumentationQuery ReferenceAPI Reference

Platform overview

What is Axiom?QuickstartArchitectureFeatures
Fundamentals
Datasets
Edge deployments
Limits
Performance
Optimize usage
Requirements
Semantic conventions
Glossary
Tour
SecurityRoadmap

Send data

Reference architecturesMethods

Understand data

Console
Query
Builder
Editor
Query results
Visualize
Traces
Metrics
Correlations
Save queries
Stream
Dashboard
Create
Elements
Create
Configure
Element types
Gauge
Heatmap
Log stream
Monitor list
Note
Pie chart
Scatter plot
Statistic
Table
Time series
Sections
Configure
Filter
Annotate
Monitor
Overview
View status
Configure
Examples
Monitor types
Anomaly
Match
Threshold
Alerting
Overview
Configure
Notifier types
Custom Webhook
Discord
Email
Microsoft Teams
Opsgenie
PagerDuty
Slack
Manage
Datasets
Overview
Views
Virtual fields
Access
RBAC
Tokens
CLI
Organization
Audit log
Settings
Usage and billing
Profile
Extend
Overview
AWS Lambda
AWS PrivateLink
Cloudflare Workers
Cloudflare Logpush
Convex
Grafana
Hex
Netlify
Supabase
Tailscale
Terraform
Unkey
Vercel
Intelligence
Overview
Spotlight
AI agents
Overview
MCP Server
Query cost limits
Agent-created orgs
Skills
Overview
Axiom alerting
Build dashboards
Control costs
Query metrics
SRE
Translate SPL to APL
Splunk
Overview
Splunk app
Install and configure
Commands
Examples
Portal
How it works
Set up standard mode
Set up transparent mode
Observability Cloud
SPL command support
Examples
Monitor and troubleshoot

Use cases

ObservabilityProduct analytics
LLM observability
Overview
Use Axiom AI SDK
Manual instrumentation
GenAI attributes
Redaction policies

Miscellaneous

LLMs
Overview
List of docs pages
Full docs
Query reference
FAQs
Legal
Acceptable use policy
Cookies
Data processing
HIPAA
Partner agreement
Partner program guide
Privacy policy
SLA
Terms of service
Terms of use

Send data from Rust app to Axiom

This page explains how to send data from a Rust app to Axiom.

To send data from a Rust app to Axiom, use the Axiom Rust SDK.

Info

The Axiom Rust SDK is an open-source project and welcomes your contributions. For more information, see the GitHub repository.

Prerequisites

  • Create an Axiom account.
  • Create a dataset in Axiom where you send your data.
  • Create an API token in Axiom with permissions to ingest data to the dataset you have created.

Install SDK

Add the following to your Cargo.toml:

TOML
[dependencies]
axiom-rs = "VERSION"

Replace VERSION with the latest version number specified on the GitHub Releases page. For example, 0.11.0.

If you use the Axiom CLI, run eval $(axiom config export -f) to configure your environment variables. Otherwise, create an API token and export it as AXIOM_TOKEN.

Use client

rust
use axiom_rs::Client;
use serde_json::json;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Build your client by providing a personal token and an org id:
    let client = Client::builder()
        .with_token("API_TOKEN")
        .build()?;

    // Alternatively, auto-configure the client from the environment variable AXIOM_TOKEN:
    let client = Client::new()?;

    client.datasets().create("DATASET_NAME", "").await?;

    client
        .ingest(
            "DATASET_NAME",
            vec![json!({
                "foo": "bar",
            })],
        )
        .await?;

    let res = client
        .query(r#"['DATASET_NAME'] | where foo == "bar" | limit 100"#, None)
        .await?;
    println!("{:?}", res);

    client.datasets().delete("DATASET_NAME").await?;
    Ok(())
}

For more examples, see the examples in GitHub.

Configure region

By default, the client sends data to api.axiom.co. To target a specific edge region, add the with_edge method to the builder with the edge domain that matches the region your dataset lives in:

rust
let client = Client::builder()
    .with_token("xaat-your-api-token")
    .with_edge("eu-central-1.aws.edge.axiom.co")
    .build()?;
rust
let client = Client::builder()
    .with_token("xaat-your-api-token")
    .with_edge("us-east-1.aws.edge.axiom.co")
    .build()?;

The following edge domains are available:

Edge deploymentBase domain for ingest and query
US East 1 (AWS)us-east-1.aws.edge.axiom.co
EU Central 1 (AWS)eu-central-1.aws.edge.axiom.co

For more information about edge deployments, see Edge deployments.

You can also configure the region without changing code by exporting environment variables. When you build the client with Client::new(), these are read automatically:

shell
export AXIOM_EDGE="eu-central-1.aws.edge.axiom.co"
# or, for a full URL (takes precedence over AXIOM_EDGE):
export AXIOM_EDGE_URL="https://eu-central-1.aws.edge.axiom.co"

To point at a custom edge endpoint such as a proxy or load balancer, use .with_edge_url("https://your-edge-host"). with_edge_url takes precedence over with_edge if both are set.

Info

Edge endpoints require an API token (xaat-), not a personal token (xapt-). Ingesting with a personal token against an edge endpoint returns a PersonalTokenNotSupportedForEdge error.

Optional features

You can use the Cargo features:

  • default-tls: Provides TLS support to connect over HTTPS. Enabled by default.
  • native-tls: Enables TLS functionality provided by native-tls.
  • rustls-tls: Enables TLS functionality provided by rustls.
  • tokio: Enables usage with the tokio runtime. Enabled by default.
  • async-std: Enables usage with the async-std runtime.
Was this page helpful?
Suggest edits on GitHub
On this page
Install SDKUse clientConfigure regionOptional features