9 releases

✓ Uses Rust 2018 edition

0.1.8 Jan 19, 2019
0.1.7 Jan 7, 2019
0.1.2 Dec 21, 2018

#99 in Compression

Download history 50/week @ 2019-01-11 325/week @ 2019-01-18 218/week @ 2019-01-25 260/week @ 2019-02-01 10/week @ 2019-02-22 19/week @ 2019-03-01 1/week @ 2019-03-08 20/week @ 2019-03-15 60/week @ 2019-03-22 11/week @ 2019-04-05 1/week @ 2019-04-12 11/week @ 2019-04-19

57 downloads per month

Custom license

17KB
391 lines

compressed_log

Latest Version Documentation

A Rust crate to compress logs on the fly, and send them over the network after reaching a configured threshold.

This is useful for when you have a fleet of embedded devices running a Rust program, instead of building a complicated metrics framework you can collect the normal Rust log output securely using https and efficiently using LZ4 compression.

LZ4 is both fast enough to run on even the most resource starved devices and effective enough to reduce log size by 20x or more from naive byte streams.

On the server side logs are simply dumped into a file, where they can be aggregated and processed by standard log collection tools.

Features

  • Uses log API
  • LZ4 to compress log on the fly
  • Transmits compressed data over persistent WebSocket connection
  • Configurable threshold which will trigger in-memory log rotation and data transmission.
  • Fully architecture portable, including Mips and other BE architectures

Example

Check out examples folder for more examples. Including custom formats for collected logs.

Client:

let level = Level::Info;
let logger = LoggerBuilder::new()
    .set_level(level)
    .set_compression_level(Compression::Slow)
    .set_sink_url("http://127.0.0.1:8000/sink/")
    .build()?;
log::set_boxed_logger(Box::new(logger))?;
log::set_max_level(level.to_level_filter());

Server:

The current server reference implementaiton is compressed_log_sink

Dependencies

~19MB
~342K SLoC