[][src]Crate logdna_client

A client library for communicating with LogDNA's Ingest API

This crate heavily relies on Hyper and Tokio for it's operation. It is strongly recommend to read their respective docs for advanced usage of this crate.


The general flow is quite simple, first create a new client with Client::builder.

Then call Client::send as many times a you would like.


You first need a Tokio Runtume

let mut rt = Runtime::new().expect("Runtime::new()");

The client requires a request template to generate new requests from

let params = Params::builder()

let template = RequestTemplate::builder()
    .api_key("ingestion key goes here")

Now you have everything to create a client

let client = Client::new(request_template);

To use a client, we need to call Client::send

Client::send requires an IngestBody, so let's create one

// Lets build a line, note that only line is required
let labels = Labels::new()
     .add("app", "test")
     .add("workload", "test");

let line1 = Line::builder()
     .line("this is a test")

let line2 = Line::builder()
     .line("this is also a test")

let body = IngestBody::new(vec![line1,line2]);

Now we just have to send the body using an the client you created above

let response = client.send(IngestBody::new(vec![line]));

The response needs to be spawned on the runtime you created earlier

If the reponse is not polled (spawned on a runtime) nothing will happen

assert_eq!(Response::Sent, rt.block_on(response).unwrap())



Log line and body types


Http client


Error types


Query parameters


Request types


Response types