#line-numbers #tail #logs #logging #data-stream #log-tailing #file-watch

bin+lib chase

Async + sync file-following for people who care about file rotatons and line numbers

9 releases

Uses old Rust 2015

0.1.8 Feb 21, 2018
0.1.7 Feb 20, 2018

#43 in #line-numbers

MIT license

33KB
588 lines

Chase Build Status Crates.io Chase

An implementation of async and sync file-following in Rust for people who care about line numbers.

Goals

  • Provide line numbers with each line yielded
  • Ability to exit the watch loop programmatically
  • Deals with file rotations automatically
  • Cross-platform async
  • Configurable (which line to start on, delays and retries)
  • Easy to use synchronously
  • Easy to use asynchronously

Usage

You can use this tool as a lib and as a binary:

As lib

Some features (e.g. receiving as a Stream, and Serde derive for lib-provided structs) are feature-gated, so keep that in mind when adding as a dependency (refer to Cargo.toml for list of features)

As a binary

cargo install chase --features=binary

Chases a file through thick and thin.

USAGE:
    chase [OPTIONS] <f>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -L, --line <l>    The line you want to start chasing your file from [default: 0]

ARGS:
    <f>    The file you want to chase

Caveats

Windows not yet supported: need to figure out what inodes map to

Credit

Very much inspired by logwatcher

Dependencies

~0–305KB