Map all private IP to public IP for log-analyzer (#6907)

* Map all private IP to public IP for log-analyzer

* fixes

* shellcheck fixes
This commit is contained in:
Pankaj Garg
2019-11-12 15:48:46 -08:00
committed by GitHub
parent 986e9e268e
commit 24cb4798bc
2 changed files with 44 additions and 43 deletions

View File

@ -5,7 +5,7 @@
set -e
usage() {
echo "Usage: $0 <iftop log file> <temp file for interediate data> [optional public IP address]"
echo "Usage: $0 <iftop log file> <temp file for interediate data> [optional list of IP address mapping]"
echo
echo Processes iftop log file, and extracts latest bandwidth used by each connection
echo
@ -23,10 +23,11 @@ awk '{ if ($3 ~ "=>") { print $2, $7 } else if ($2 ~ "<=") { print $1, $6 }} ' <
| awk 'NR%2{printf "%s ",$0;next;}1' \
| awk '{ print "{ \"a\": \""$1"\", " "\"b\": \""$3"\", \"a_to_b\": \""$2"\", \"b_to_a\": \""$4"\"}," }' > "$2"
if [ "$#" -lt 4 ]; then
if [ "$#" -lt 3 ]; then
solana-log-analyzer iftop -f "$2"
else
solana-log-analyzer iftop -f "$2" map-IP --priv "$3" --pub "$4"
list=$(cat "$3")
solana-log-analyzer iftop -f "$2" map-IP --list "$list"
fi
exit 1