Skip to content

Instantly share code, notes, and snippets.

@weapp
Forked from kartikshah/tail-color.sh
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weapp/15edf70785252e70a7a8 to your computer and use it in GitHub Desktop.
Save weapp/15edf70785252e70a7a8 to your computer and use it in GitHub Desktop.
Color output of linux tail command
$tail -100f /var/log/applications/application.log | awk '
/INFO/ {print "\033[32m" $0 "\033[39m"}
/Exception/ {print "\033[31m" $0 "\033[39m"}
'
@weapp
Copy link
Author

weapp commented Aug 3, 2015

Symfony2:
tail -100f /var/log/applications/application.log | awk '
/(request|app).INFO/ {print "\033[36m" $0 "\033[39m"}
/(request|app).WARNING/ {print "\033[33m" $0 "\033[39m"}
/(request|app).ERROR/ {print "\033[31m" $0 "\033[39m"}
/(request|app).CRITICAL/ {print "\033[31m" $0 "\033[39m"}
'

all lines:
$tail -f /var/log/applications/application.log | awk '
// {print $0}
/INFO/ {print "\033[32m" $0 "\033[39m"}
'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment