Giter VIP home page Giter VIP logo

eye.awk's Introduction

eye.awk

Tiny awk script to improve kubernetes logs reading experience.

asciicast

Best for:

  • live tailing
  • printing logs in CI

Features:

  • colours and higlights, colorblind-friendly palette is default
  • emojis ๐Ÿ””
  • stats and filters
  • install with no dependencies
  • easy to customize

Usage

# from file
eye.awk file.log

# from pipe
kubectl logs -f -n kube-system calico-node-xx |eye.awk

# also works with kubetail, docker logs, journalctl -u containerd -u kubelet, ...

# if piping to less: use uppercase '-R' option for correct display
cat file.log |eye.awk |less -R

# if piping from kubetail, use '-k pod' option for best display
kubetail -k pod -n kube-system |eye.awk

# More info about usage:
echo |eye.awk

Install

Requirements

Nothing but a shell with any flavour of awk.

Install via curl

Choose a target directory, dowload and set alias:

curl https://raw.githubusercontent.com/jseguillon/eye.awk/main/eye.awk -O /my_install_path/eye.awk
alias eye.awk='awk -f /my_install_path/eye.awk '

Install vai Heredoc paste

Choose target directory, copy snippet first line, press Enter, paste source script, press Enter, type EOF and Enter again, and finally alias:

cat <<'EOF' > /my_install_path/eye.awk
..... copy here source file .....
EOF
alias eye.awk='awk -f /my_install_path/eye.awk '

Alternatively you can copy paste in preffered editor if available.

Options

Modes

Available rendering modes:

  • -v mode=emoji: add by level emoji at beginning of line
  • -v mode=gs: use grayscale palette
  • -v mode=ryb: use red-yellow-blue palette
  • -v mode=stats: show stats
  • -v mode=showConfig: show current regex config

Modes can be combined. Example:

eye.awk -v mode=emoji,gs,stats file.log

Palette modes are exclusive.

Per level ignoring

You can ignore some lines of logs using: -v ignore_error, -v ignore_warning, -v ignore_info and -v ignore_debug. Examples:

# skip info logs about 200 OK probes
kubetail -n my_namespace |eye.awk -v ignore_info='"statusCode":200.*"url":"/api/ping'

# skip spam error message
kubetail -n my_namespace |eye.awk -v ignore_error='myapp.*unable to get metrics.*'

License

MIT

Plus: If this tool is widely adopted, I promise I won't complain I do not make money with it ๐Ÿ˜„

eye.awk's People

Contributors

jseguillon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

davidaparicio

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.