logstash-rs

Crates.iologstash-rs
lib.rslogstash-rs
version0.1.0
sourcesrc
created_at2022-05-15 16:06:41.751555
updated_at2022-05-15 16:06:41.751555
descriptionLogstash sender
homepagehttps://github.com/qoollo/rust-log4rs-logstash
repositoryhttps://github.com/qoollo/rust-log4rs-logstash
max_upload_size
id587217
size19,662
Vladimir Stepanenko (vovac12)

documentation

https://docs.rs/logstash-rs

README

logstash-rs

TCP log sender for Logstash.

Get started

Add dependency to your Cargo.toml

logstash-rs = 0.1.0

Or using upstream version from Github

logstash-rs = { git = "https://github.com/qoollo/rust-log4rs-logstash" }

Initialize logger

use logstash_rs::{BufferedSender, TcpSender};
use std::time::Duration;

fn main() {
    let logger = BufferedSender::new(
        TcpSender::new("localhost".to_string(), 3055, false), // hostname, port, use tls
        Some(64), // buffer size
        Some(Duration::from_secs(60)), // buffer lifetime
    );
    log::set_boxed_logger(Box::new(logger)).unwrap();

    log::error!("Test");
}
Commit count: 41

cargo fmt