use axiom_rs::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Auto-configure the client from the environment variable AXIOM_TOKEN:
let client = Client::new()?;
client
.ingest(
"DATASET_NAME",
vec![json!({
"foo": "bar",
})],
)
.await?;
let _res = client
.query(r#"['DATASET_NAME'] | where foo == "bar" | limit 100"#, None)
.await?;
Ok(())
}
cargo add axiom-rs
You can use the Cargo features:
default-tls
: Provides TLS support to connect over HTTPS. Enabled by default.native-tls
: Enables TLS functionality provided bynative-tls
.rustls-tls
: Enables TLS functionality provided byrustls
.tokio
: Enables usage with thetokio
runtime. Enabled by default.async-std
: Enables usage with theasync-std
runtime.
Read documentation on axiom.co/docs/guides/rust.