Tuesday, May 14, 2013

Tailing logs with color Tail -f


Try this:



tail -f path-to-logs/server.log | perl -pe 's/(.*?)(ERROR|error|.*Exception:)(.*)/$1\e[1;31m$2\e[0m$3/g'


for more colors, items, add more

 | perl -pe 's/(.*?)(yada-yada:)(.*)/$1\e[1;31m$2\e[0m$3/g'

and for other colors:

in \e[1;31m

31 - red
32 - green
33 - yellow
etc