Add logs subcommand to fetch remote logs from each network node

This commit is contained in:
Michael Vines 2018-12-23 08:54:24 -08:00 committed by Grimes
parent 58a4905916
commit a6fd1ca3db

View File

@ -23,6 +23,7 @@ Operate a configured testnet
stop - Stop the network stop - Stop the network
restart - Shortcut for stop then start restart - Shortcut for stop then start
update - Live update all network nodes update - Live update all network nodes
logs - Fetch remote logs from each network node
start/update-specific options: start/update-specific options:
-S [snapFilename] - Deploy the specified Snap file -S [snapFilename] - Deploy the specified Snap file
@ -47,6 +48,9 @@ Operate a configured testnet
stop-specific options: stop-specific options:
none none
logs-specific options:
none
EOF EOF
exit $exitcode exit $exitcode
} }
@ -472,6 +476,26 @@ sanity)
stop) stop)
stop stop
;; ;;
logs)
fetchRemoteLog() {
declare ipAddress=$1
declare log=$2
echo "--- fetching $log from $ipAddress"
(
set -x
timeout 30s scp "${sshOptions[@]}" \
"$ipAddress":solana/"$log".log log/remote-"$log"-"$ipAddress".log
) || echo "failed to fetch log"
}
fetchRemoteLog "${fullnodeIpList[0]}" drone
for ipAddress in "${fullnodeIpList[@]}"; do
fetchRemoteLog "$ipAddress" fullnode
done
for ipAddress in "${clientIpList[@]}"; do
fetchRemoteLog "$ipAddress" client
done
;;
*) *)
echo "Internal error: Unknown command: $command" echo "Internal error: Unknown command: $command"
exit 1 exit 1