SDKs

Rust SDK

Install the Logdash Rust SDK, send your first log and your first metric.

Install the package, add your ingest key and the first log lands in the dashboard within a second. Everything below is copied from the Rust SDK README.

Install

cargo add logdash

Initialise

Copy the ingest key from your domain's settings in Logdash and keep it in an environment variable. The key identifies the domain the data lands in, and app names the program that sends, such as api or worker. See Apps.

// Config::default() reads LOGDASH_API_KEY from the environment.
let (logger, metrics) = logdash::create_logdash(
    logdash::Config::default().app("api".into()),
);

Send a log

let (logger, _) = logdash::create_logdash(logdash::Config::default());

// Send an info log message
logger.info("Rust SDK example");

Send a metric

Metrics are named numbers. Set one to an absolute value or mutate it by a delta, and Logdash charts the history.

let (_, metrics) = logdash::create_logdash(logdash::Config::default());

// create a metric
metrics.set("users".into(), 0.0);

// or increment / decrement by
metrics.mutate("users".into(), 1.0);

Send an event

Events go to web analytics of the domain, next to the custom events of your website, with the same rules for names and properties.

logdash::create_logdash(logdash::Config::default());

// track that a signed-in user ran an agent
logdash::track(
    "agent_run",
    &[("agent", "support".into()), ("steps", 4.into()), ("success", true.into())],
    Some(&user.id),
);

Flush before exit

The SDK sends in the background. In a short-lived process, such as a cron job, a CLI or a serverless function, send what is still queued before the process exits.

// wait until the logs, metrics and events queued so far are sent
logdash::flush();

Works with

  • Axum
  • Actix Web
  • Rocket
  • Tokio
  • CLI binaries

FAQ

Where does it read the API key from?
logdash::Config::default() picks up LOGDASH_API_KEY from the environment. To pass it explicitly, use logdash::Config::default().api_key("your-api-key".into()).
What does create_logdash return?
A (logger, metrics) tuple. Destructure the half you need and drop the other with _.
What types do metric names and values take?
The name is an owned string, so pass "users".into(), and the value is a float: metrics.set("users".into(), 0.0).

Copied from the rust-sdk README at 155c9a4 on 2026-11-09.