Skip to content

Latest commit

 

History

History
121 lines (97 loc) · 2.86 KB

README.md

File metadata and controls

121 lines (97 loc) · 2.86 KB

regtail

Regex base tail written in Rust.

Build Status License pre-commit

Documentation quick links

Why regtail?

tail -F is very common way to monitor log files. Although it requires specify the monitored files before it's launched as below.

> ls
log.20190101 log.20190102
> tail -F log.*
==> log.20190101 <==
This is log.20190101

==> log.20190102 <==
This is log.20190102

It seems to be sufficient to monitor all log files. But actually this IS NOT the sufficient way as follows:

term1 > ls
log.20190101 log.20190102
term1 > tail -F log.*
==> log.20190101 <==
This is log.20190101

==> log.20190102 <==
This is log.20190102
term2 > echo "This is log.20190103" > log.20190103
term1 > # No output on term1

Newly created file is not monitored at all!

This problem is solved by regtail! You just run regtail with no arguments as follows:

term1 > ls
log.20190101 log.20190102
term1 > regtail
==> log.20190101 <==
This is log.20190101

==> log.20190102 <==
This is log.20190102
term2 > echo "This is log.20190103" > log.20190103
term1 > # term1 output is below

==> log.20190103 <==
This is log.20190103

Moreover you can specify target files with regular expression as follow:

> ls
error.20180101 error.20190101 error.20190102 log.20190101 log.20190102
> regtail 'error\.\d{4}0101'
==> error.20180101 <==
This is error.20180101

==> error.20190101 <==
This is error.20190101

Regtail is the perfect way to monitor your log files in all situation, isn't it?

Installation

Homebrew

brew tap StoneDot/regtail
brew install regtail

Binary

# Linux x86_64
wget https://github.com/StoneDot/regtail/releases/download/v0.1.1/regtail-v0.1.1-x86_64-unknown-linux-gnu.tar.gz
tar zxf regtail-v0.1.1-x86_64-unknown-linux-gnu.tar.gz
cd regtail-v0.1.1-x86_64-unknown-linux-gnu
sudo cp regtail /usr/local/bin

Source build

wget https://github.com/StoneDot/regtail/archive/v0.1.1.tar.gz
tar zxf v0.1.1.tar.gz
cd regtail-0.1.1
cargo install --root $HOME --path .
export PATH="$HOME/bin:$PATH"

Benchmark

$ sudo -s
# On your root session type below
# CAUTION: Internally,
$ cargo bench

Development

We use git pre-commit hook to ensure that the code is well formatted and clippy does not raise warning. You should follow below instructions before starting development.

# Install the pre-commit framework
# See: https://pre-commit.com/
$ pre-commit install