Highlight your logs

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'
Jan 20 17:04:04 bagheera httpd: [20/Jan/2011:17:04:04 +0100] 10.0.0.62 TLSv1 AES256-SHA "POST /wp-login.php HTTP/1.1" 5
Jan 20 17:04:08 bagheera httpd[17951]: [error] ALERT - script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker '10.0.0.62', file '/www.tumfatig.net/wp-admin/admin.php', line 96)
Jan 20 17:04:10 bagheera httpd: [20/Jan/2011:17:04:10 +0100] 10.0.0.62 TLSv1 AES256-SHA "GET /wp-admin/ HTTP/1.1" 49959

Continue reading “Highlight your logs”