Highlight your logs
54 words, 1 minutes
Logs are great. Logs are cool. Logs are helpful. But logs are monochrome.
Unless you ask the camel to colorize them:
# tail -f /var/log/httpd/20110120 | \
perl -pe 's/.*b(error)b.*/e[1;31m$&e[0m/g'
You can also do it with Sed
. Here’s a Postfix example:
# tail -256f /home/log/luuna/postfix/20110202 | \
sed -e "s/(NOQUEUE: [a-z]*:)/$DRED1$BLANK/" -e "s/(status=[a-z]* )/$DCYAN1$BLANK/"