https://github.com/stonedot/regtail
Regex base tail written in Rust
https://github.com/stonedot/regtail
monitor regex rust tail
Last synced: 5 months ago
JSON representation
Regex base tail written in Rust
- Host: GitHub
- URL: https://github.com/stonedot/regtail
- Owner: StoneDot
- License: apache-2.0
- Created: 2018-12-22T06:13:16.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2023-03-20T16:59:52.000Z (over 3 years ago)
- Last Synced: 2023-08-09T22:12:06.988Z (almost 3 years ago)
- Topics: monitor, regex, rust, tail
- Language: Rust
- Homepage:
- Size: 241 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# regtail
Regex base tail written in Rust.
[](https://app.travis-ci.com/StoneDot/regtail)
[](https://opensource.org/licenses/Apache-2.0)
[](https://github.com/pre-commit/pre-commit)
## Documentation quick links
* [Why regtail?](#why-regtail)
* [Installation](#installation)
* [Development](#development)
# 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.
```bash
> 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:
```bash
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:
```bash
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:
```bash
> 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
```bash
brew tap StoneDot/regtail
brew install regtail
```
## Binary
```bash
# 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
```bash
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
```shell
$ 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.
```shell
# Install the pre-commit framework
# See: https://pre-commit.com/
$ pre-commit install
```