this script will show error messages in red, and warning messages in yellow:
this was pretty straight forward and can be easily modified. to use this, i put this in a script called highlighter.pl, and pipe my logs through it:#!/usr/bin/perl
use strict;
use Term::ANSIColor;
while (<stdin>){
if ($_ =~ m/(exception|error)/i){
print color 'bold red';
print $_;
print color 'reset';
}elsif ($_ =~ m/(warning)/i){
print color 'bold yellow';
print $_;
print color 'reset';
}else{
print $_;
}
}
tail -F server.log | ~/bin/highlighter.pl