All Projects → maxpert → Drep

maxpert / Drep

Licence: mit
dynamic regular expression print

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Drep

Evergreen
Most natural Swift logging
Stars: ✭ 75 (-6.25%)
Mutual labels:  logging
Log
A universal log interface
Stars: ✭ 77 (-3.75%)
Mutual labels:  logging
Diary
📑 Zero-dependency, fast logging library for both Node and Browser.
Stars: ✭ 79 (-1.25%)
Mutual labels:  logging
Nostromo
CLI for building powerful aliases
Stars: ✭ 76 (-5%)
Mutual labels:  tool
Queryql
Easily add filtering, sorting, and pagination to your Node.js REST API through your old friend: the query string!
Stars: ✭ 76 (-5%)
Mutual labels:  filtering
Labeler
Manage labels on GitHub as code
Stars: ✭ 78 (-2.5%)
Mutual labels:  tool
Image To Xls
A simple tool to make ascii art from an image using excel colored cells.
Stars: ✭ 75 (-6.25%)
Mutual labels:  tool
Network Threats Taxonomy
Machine Learning based Intrusion Detection Systems are difficult to evaluate due to a shortage of datasets representing accurately network traffic and their associated threats. In this project we attempt at solving this problem by presenting two taxonomies
Stars: ✭ 79 (-1.25%)
Mutual labels:  tool
Mrbutler
Reactive Android App Permissions API with delegates and logging
Stars: ✭ 77 (-3.75%)
Mutual labels:  logging
Superseriousstats
superseriousstats is a fast and efficient program to create statistics out of various types of chat logs
Stars: ✭ 78 (-2.5%)
Mutual labels:  logging
Laravel Log To Db
Custom Laravel and Lumen 5.6+ Log channel handler that can store log events to SQL or MongoDB databases. Uses Laravel/Monolog native logging functionality.
Stars: ✭ 76 (-5%)
Mutual labels:  logging
Easygrid
EasyGrid - VanillaJS Responsive Grid
Stars: ✭ 77 (-3.75%)
Mutual labels:  filtering
Zpyi
The power of python in your Zsh - Unobtrusive and easy python scripting in shell
Stars: ✭ 78 (-2.5%)
Mutual labels:  tool
Appimage Builder
Recipe based AppImage creation tool
Stars: ✭ 76 (-5%)
Mutual labels:  tool
Kafkawize
Kafkawize : A Self service Apache Kafka Topic Management tool/portal. A Web application which automates the process of creating and browsing Kafka topics, acls, schemas by introducing roles/authorizations to users of various teams of an org.
Stars: ✭ 79 (-1.25%)
Mutual labels:  tool
Flutter Boilerplate Project
A boilerplate project created in flutter using MobX and Provider.
Stars: ✭ 1,194 (+1392.5%)
Mutual labels:  logging
Ptdesigner
Library and GUI tool for designing and generation of procedural textures, made as a part of my Bachelor thesis.
Stars: ✭ 77 (-3.75%)
Mutual labels:  tool
Surf
Easy and powerful PHP deployment tool
Stars: ✭ 79 (-1.25%)
Mutual labels:  tool
Forge
Basic experiment framework for tensorflow.
Stars: ✭ 79 (-1.25%)
Mutual labels:  logging
Browser Bunyan
An adaptation of, the Node logging library, Bunyan specifically for the browser.
Stars: ✭ 78 (-2.5%)
Mutual labels:  logging

Rust Version

drep is dynamic regular expression print

drep is grep with dynamic reloadable filter expressions. This allows filtering stream of logs/lines, while changing filters on the fly.

Filter is either a regex or plain text match, provided via input file.
Here is an example usage:

tail -f /var/log/nginx/error.log | drep -f /etc/drep/filters

Usually you will end up using this with your servers:

java -jar my-server.jar | drep -f server-filters

or

./uwsgi -s :8080 -w my_app  | drep -f server-filters

Filter file syntax

Each line of the filters file is an expression that starts with ~, =, !=, or !~. The matches will be done in the order filters written in the file, and if a filter matches subsequent filters won't be executed.

  • Any line that starts with !~ implies does not match regex, e.g: !~"time": \d+.\d{0,2}
  • Any line that starts with ~ implies match regex, e.g: ~"time": \d+.\d{3,}
  • Any line that starts with != implies does not contain text, e.g: !=INFO
  • Any line that starts with = implies contain text, e.g: ="total-duration"

Everything else is ignored, as you can see from plain text. For regular expression documentation please refer to this document.

Why?

While grep --line-buffered can do something similar changing regex on the fly is not possible. Change filter regex on the fly is extremely useful in server/process environments where it's not possible to restart the process just to change the grep filter.

Building on unix philosophy drep does only one job well, given bunch of filter from an input file it can filter input lines to stdout.

Features

  • Lightweight on CPU, and memory (~3MB memory foot print, and 2 threads in total).
  • Watch and reload filters file.
  • No GC pauses and memory safe (Written in Rust).
  • Plain text & regex matching (with negation support).

Usage example

Given following simple fizzbuzz.py:

import time

i = 1
while True:
    fb = ""
    if i % 3 == 0:
        fb = "fizz"
    if i % 5 == 0:
        fb = "{}buzz".format(fb)

    if fb:
        print("{}. {}".format(i, fb), flush=True)

    i = i + 1
    time.sleep(0.1)

We can launch and pipe it's output python fizzbuzz.py | drep -f filters. Now if the contents of filters are:

~\sfizz\n

drep will only emit logs with fizz. e.g.

642. fizz
648. fizz
651. fizz
654. fizz
...

While keeping the process running without exiting you can just modify filters to:

~\sbuzz\n

This will change the drep output on the fly to only emit buzz:

805. buzz
815. buzz
820. buzz
...

Building

Just clone the repo and run cargo build --release.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].