Although extremely useful, http server access logs are a mess in their raw form. If you're interested in watching your http server logs in real time with formatting rules and pretty colors, this post is for you.
Teh Scr1pt
Create a new file to put the l33t code into:
rewt@bawnx ~# vim /usr/local/bin/httptail
Add this mess:
#!/bin/sh GREENY=`echo -en '\e[32m'` YELLOW=`echo -en '\e[93m'` RESET=`echo -en '\e[00m'` tail -f httpd_access.log |sed -e "s/^.*\]: //g;s/ www.somedomain.*\] \"/ \"/g;s/ HTTP\/.* \"/\" /g;s/\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\)/$GREENY\1$RESET/g;s/\(\"[^\"]*\"\)/$YELLOW\1$RESET/g"
Stuff You Need to Change:
- The access log filename
- www.somedomain - if you're not sure what goes here ...
Now, save the file and make it executable.
rewt@bawnx ~# chmod +x /usr/local/bin/httptail
Run it and enjoy the show:
rewt@bawnx ~# httptail ...........
Word Count: 227




3 (Comments|Trackbacks)
[ RSS feed | Trackback URI | Leave a Comment ]
It works, thanks for the great resource.
Why arent you upating your blo more often ?
Hard coming up with topics to write about, not to mention the lack of time.. What else is new, though?
Guy
Leave a Comment
Trackback Responses to This Post: