Skip to content

Instantly share code, notes, and snippets.

@manuartero
Created December 14, 2015 16:34
Show Gist options
  • Save manuartero/9b07879375775c904fbc to your computer and use it in GitHub Desktop.
Save manuartero/9b07879375775c904fbc to your computer and use it in GitHub Desktop.
log path_to_log_file
#!/bin/bash
# $1 path_to_log_file
if [ -z "$1" ] ; then
echo "log {path_to_log_file}"
exit 1
fi
tail -f -n 10000 $1 | awk '
/DEBUG/ {print "\033[36m" $0 "\033[39m"}
/INFO/ {print "\033[32m" $0 "\033[39m"}
/WARN/ {print "\033[33m" $0 "\033[39m"}
/ERROR/ {print "\033[31m" $0 "\033[39m"}
' | less -R
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment