Giter VIP home page Giter VIP logo

summertail's Introduction

summertail Summarize your tail -f output, with regexes

You won't be able to count how many apache 200's are in the logs, so use a regex counter.

Watching hundreds of lines of log files scroll by doesn't mean you know what happened

Usage

summertail DELAY REGEX1 REGEX2 ...

Reads input from stdin, and for each line keeps track of how many of each REGEX is matched. Every DELAY seconds, the counters are reset, and a \n is printed.

The last column (other) is incremented for every line which doesn't match any of the regexes. If a line matches more than one regex, it will be counted for each regex.

If the REGEX starts with ! it will invert the regex. i.e. it counts lines which don't match that regex.

Installation

Install with cargo install summertail.

Example

$ tail -f /var/log/apache2/access.log | summertail 10s ' 200 ' ' 3\d\d ' \!' 200 '
๐Ÿ•›๏ธŽ10:16:22 27 โ–ƒโ–   200 : 17 ( 63%) โ–†โ–Š   3\d\d : 10 ( 37%) โ–ƒโ–  ! 200 : 10 ( 37%) โ–ƒโ–  other:  0 (  0%)     
๐Ÿ•›๏ธŽ10:16:32 37 โ–„โ–Œ   200 : 15 ( 41%) โ–„โ–Œ   3\d\d : 19 ( 51%) โ–…โ–‹  ! 200 : 22 ( 59%) โ–…โ–‹  other:  0 (  0%)     
๐Ÿ•š๏ธŽ10:16:41 23 โ–ƒโ–   200 :  8 ( 35%) โ–ƒโ–   3\d\d : 15 ( 65%) โ–†โ–Š  ! 200 : 15 ( 65%) โ–†โ–Š  other:  0 (  0%)     
๐Ÿ•›๏ธŽ10:16:52 23 โ–ƒโ–   200 :  6 ( 26%) โ–ƒโ–   3\d\d : 16 ( 70%) โ–†โ–Š  ! 200 : 17 ( 74%) โ–†โ–Š  other:  0 (  0%)     
๐Ÿ•›๏ธŽ10:17:02 47 โ–…โ–‹   200 : 11 ( 23%) โ–‚โ–Ž   3\d\d : 34 ( 72%) โ–†โ–Š  ! 200 : 36 ( 77%) โ–‡โ–‰  other:  0 (  0%)     
๐Ÿ•›๏ธŽ10:17:13 41 โ–„โ–Œ   200 : 13 ( 32%) โ–ƒโ–   3\d\d : 24 ( 59%) โ–…โ–‹  ! 200 : 28 ( 68%) โ–†โ–Š  other:  0 (  0%)     
๐Ÿ•›๏ธŽ10:17:23 48 โ–…โ–‹   200 : 20 ( 42%) โ–„โ–Œ   3\d\d : 27 ( 56%) โ–…โ–‹  ! 200 : 28 ( 58%) โ–…โ–‹  other:  0 (  0%)     
๐Ÿ•›๏ธŽ10:17:33 53 โ–†โ–Š   200 : 25 ( 47%) โ–„โ–Œ   3\d\d : 28 ( 53%) โ–…โ–‹  ! 200 : 28 ( 53%) โ–…โ–‹  other:  0 (  0%)     
๐Ÿ•›๏ธŽ10:17:44 30 โ–ƒโ–   200 :  9 ( 30%) โ–ƒโ–   3\d\d : 21 ( 70%) โ–†โ–Š  ! 200 : 21 ( 70%) โ–†โ–Š  other:  0 (  0%)     
๐Ÿ•›๏ธŽ10:17:54 79 โ–ˆโ–ˆ   200 : 31 ( 39%) โ–„โ–Œ   3\d\d : 43 ( 54%) โ–…โ–‹  ! 200 : 48 ( 61%) โ–…โ–‹  other:  0 (  0%)     
๐Ÿ•›๏ธŽ10:18:04 129 โ–ˆโ–ˆ   200 :  69 ( 53%) โ–…โ–‹   3\d\d :  60 ( 47%) โ–„โ–Œ  ! 200 :  60 ( 47%) โ–„โ–Œ  other:   0 (  0%)     
๐Ÿ•›๏ธŽ10:18:14  19 โ–‚โ–Ž   200 :   5 ( 26%) โ–ƒโ–   3\d\d :  14 ( 74%) โ–†โ–Š  ! 200 :  14 ( 74%) โ–†โ–Š  other:   0 (  0%)     
๐Ÿ•š๏ธŽ10:18:24  62 โ–…โ–‹   200 :  22 ( 35%) โ–ƒโ–   3\d\d :  38 ( 61%) โ–…โ–‹  ! 200 :  40 ( 65%) โ–†โ–Š  other:   0 (  0%)     
๐Ÿ•š๏ธŽ10:18:34 159 โ–ˆโ–ˆ   200 :  20 ( 13%) โ–‚โ–Ž   3\d\d : 138 ( 87%) โ–‡โ–‰  ! 200 : 139 ( 87%) โ–‡โ–‰  other:   0 (  0%)     
๐Ÿ•›๏ธŽ10:18:44  34 โ–‚โ–Ž   200 :   4 ( 12%) โ–โ–   3\d\d :  30 ( 88%) โ–ˆโ–ˆ  ! 200 :  30 ( 88%) โ–ˆโ–ˆ  other:   0 (  0%)     
๐Ÿ•›๏ธŽ10:18:55  50 โ–ƒโ–   200 :  10 ( 20%) โ–‚โ–Ž   3\d\d :  40 ( 80%) โ–‡โ–‰  ! 200 :  40 ( 80%) โ–‡โ–‰  other:   0 (  0%)

Copyright

Copyright ยฉ 2022, GNU Affero GPL licence v3 or later. Source code: https://github.com/amandasaurus/summertail

summertail's People

Contributors

amandasaurus avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.