Wednesday, February 3, 2010

Colorized Log Files - Ack Attack

Apache log colorizers exist, but few are as useful and easily configurable as a simple ack passthrough script.
source: http://blog.powdahound.com/post/209624101/colorize-log-output-with-ack

This is my current log analyzer for a log that also has errors piped into it with a fun htaccess directive:

php_flag log_errors on
php_value error_log /my/error/log

Here is my current ack line:

tail -f /my/error/log \
| ack --flush --passthru --color --color-match=blue "http://[^\s]*" \
| ack --flush --passthru --color --color-match=blue "\s/[^\s]*" \
| ack --flush --passthru --color --color-match=red "Permission denied|PHP Fatal error:|File does not exist" \
| ack --flush --passthru --color --color-match=red "on line \d+"

No comments:

Post a Comment