An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# regtail
Regex base tail written in Rust.

[![Build Status](https://app.travis-ci.com/StoneDot/regtail.svg?branch=main)](https://app.travis-ci.com/StoneDot/regtail)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](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
```