qoollo-logstash-rs

Crates.ioqoollo-logstash-rs
lib.rsqoollo-logstash-rs
version0.2.0
sourcesrc
created_at2023-01-20 14:32:07.888098
updated_at2023-01-20 14:32:07.888098
descriptionLogstash sender
homepagehttps://github.com/qoollo/rust-log4rs-logstash
repositoryhttps://github.com/qoollo/rust-log4rs-logstash
max_upload_size
id763399
size21,228
(idruzhitskiy)

documentation

https://docs.rs/logstash-rs

README

Logstash log sender

Crate Status

TCP log sender for Logstash.

Previously published under the name logstash-rs.

Get started

Add dependency to your Cargo.toml

qoollo-logstash-rs = 0.2

Or using upstream version from Github

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

Initialize logger

use qoollo_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