Created
July 24, 2015 07:40
-
-
Save raminv80/f1aa5acf6ba5f77b8522 to your computer and use it in GitHub Desktop.
Easily view paper trail log files
This file contains 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
GNU nano 2.3.1 File: search.sh | |
#!/bin/sh | |
# Linux users have to change $8 to $9 | |
awk '\ | |
function red(s) { | |
printf "\033[1;31m" s "\033[0m " | |
} | |
function green(s) { | |
printf "\033[1;32m" s "\033[0m " | |
} | |
function blue(s) { | |
printf "\033[1;34m" s "\033[0m " | |
} | |
function severity(s){ | |
IGNORECASE = 1 | |
if(s ~ /error/) { | |
red(s) | |
}else{ | |
green(s) | |
} | |
} | |
{ | |
IGNORECASE = 1 | |
if ($9 ~ /production/) { | |
printf ("%s %s $s",blue($2), severity($8),$5); | |
for(i=10;i<NF;i++){ | |
printf "%s ",$i | |
} | |
printf "\n" | |
} | |
} | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment