More readable acces.log & debug from squid


Example more readable cat from squid acces.log

watch "tail  /var/log/squid/access.log | cut -d' ' -f 1-8,13,16 | perl -pe 's/\d+/localtime($&)/e'";

Green mark line when cached operation

 while true; do sleep 2; clear; tail -40  /var/log/squid/access.log 1> >(while read line; do  case "$line" in (*"/304"*) echo -e "\e[7;49;92m$line\e[0m";; (*"/200"*) echo -e "\e[90mDark $line\e[0m";; (*) echo -e "$line";; esac; done ); done ;

When use debug output to console :

  squid squid  -d1  2> >(while read line; do case "$line" in ; (*"ERROR"*) echo -e "\e[7;49;91m$line\e[0m" ;; (*"FATAL"*) echo -e "\e[7;49;93m$line\e[0m" ;;(*"WARNING"*) echo -e "\e[01;35m$line\e[0m" ;; (*"Cannot"*) echo -e "\e[01;96m$line\e[0m" ;; (*"Disable"*) echo -e "\e[01;30m$line\e[0m" ;;(*) echo "$line" ;; esac  ; done)
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s