Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A simple C* log collect script
#!/bin/sh
endpoints=$1
output=$2
if [ -z $endpoints ] || [ -z $output ];then
echo "Usage: $0 endpoints out_dir"
exit 1
fi
LOG_PATH=/var/log/cassandra
targets=$(echo $endpoints | tr "," " ")
for target in $targets
do
ssh $target tar czf /tmp/${target}.tar.gz -C $(dirname $LOG_PATH ) $(basename $LOG_PATH) 2>/dev/null
scp $target:/tmp/${target}.tar.gz $output 2>/dev/null
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment