Friday 26 June 2009

Colorful tail

Well I use tail a lot to monitor my jboss logs. On windows/wine I use this great utility 'BareTail' to monitor logs where I can color code tags like Exception, Error, Warning and so on.. This is visually very appealing.
In plain tail command you you actually need to scan the whole log to get to error. So I was looking to color code tail and guess what it is pretty easy to do by using perl.

tail -n 1000 -f file name | perl -pe 's/.*Exception.*/\e[0;31;33m$&\e[0m/g'


This is so cool and this thing goes to .bashrc so now I have baretail like visually appealing tail :)

No comments: