3 releases

0.1.2 Apr 25, 2021
0.1.1 Apr 2, 2021
0.1.0 Oct 3, 2020

#18 in #ftp

Download history 112/week @ 2022-11-27 13/week @ 2022-12-04 72/week @ 2022-12-11 125/week @ 2022-12-18 20/week @ 2022-12-25 33/week @ 2023-01-01 101/week @ 2023-01-08 46/week @ 2023-01-15 56/week @ 2023-01-22 25/week @ 2023-01-29 38/week @ 2023-02-05 99/week @ 2023-02-12 20/week @ 2023-02-19 25/week @ 2023-02-26 37/week @ 2023-03-05 7/week @ 2023-03-12

89 downloads per month
Used in unftp

Apache-2.0

15KB
278 lines

slog-redis

This crate implements a slog drain that outputs to a Redis list.

Useful for centralized logging using a RELK stack (Redis, Elasticsearch, Logstash and Kibana). All log messages are sent to a Redis server, in Logstash message V0 format, ready to be parsed/processed by Logstash.

The format looks like this:

 {
    "@timestamp": ${timeRFC3339},
    "@source_host": ${hostname},
    "@message": ${message},
    "@fields": {
       "level": ${levelLowercase},
       "application": ${appName}
       ... // logged field 1
       ... // logged field 2
       ...
   }

Example Usage:

 use slog::*;
 use slog_redis::Builder;

 let redis_drain = Builder::new("my-app-name")
   .redis_host("localhost")
   .redis_key("my_redis_list_key")
   .build()
   .unwrap();

 let drain = slog_async::Async::new(redis_drain.fuse()).build().fuse();

 let log = Logger::root(drain, o!());
 info!(log, "Send me to {}!", "Redis"; "msg" => "Hello World!");

Dependencies

~5–10MB
~216K SLoC