Skip to content

Portable logs post-processing awk script - colours, emojis and more for Kubernetes logs, containers, journalctl, etc..

Notifications You must be signed in to change notification settings

jseguillon/eye.awk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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 😄

About

Portable logs post-processing awk script - colours, emojis and more for Kubernetes logs, containers, journalctl, etc..

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages