Created
November 4, 2010 22:35
-
-
Save adamv/663328 to your computer and use it in GitHub Desktop.
Colorize access_log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Escaped color codes | |
BLACK=`echo -e '\033[0;30m'` | |
DK_GREY=`echo -e '\033[1;30m'` | |
RED=`echo -e '\033[0;31m'` | |
PINK=`echo -e '\033[1;31m'` | |
GREEN=`echo -e '\033[0;32m'` | |
LT_GREEN=`echo -e '\033[1;32m'` | |
BROWN=`echo -e '\033[0;33m'` | |
YELLOW=`echo -e '\033[1;33m'` | |
BLUE=`echo -e '\033[0;34m'` | |
LT_BLUE=`echo -e '\033[1;34m'` | |
PURPLE=`echo -e '\033[0;35m'` | |
LT_PURPLE=`echo -e '\033[1;35m'` | |
CYAN=`echo -e '\033[0;36m'` | |
LT_CYAN=`echo -e '\033[1;36m'` | |
LT_GREY=`echo -e '\033[0;37m'` | |
WHITE=`echo -e '\033[1;37m'` | |
COLOR_NONE=`echo -e '\033[0m'` | |
tail -f /var/log/httpd/access_log | sed \ | |
-e "/GET \/favicon.ico/d" \ | |
-e "s/^.* 40[012356789] .*$/$PINK&$COLOR_NONE/" \ | |
-e "s/^.* 404 .*$/$BROWN&$COLOR_NONE/" \ | |
-e "s/^.* 500 .*$/$PURPLE&$COLOR_NONE/" |
Author
adamv
commented
Nov 4, 2010
- Ignore favicon.ico; it is boring.
- Highlight 40x errors...
- ...except highlight 404 errors different.
- 500 errors are even more special.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment