Skip to content

Instantly share code, notes, and snippets.

@reddikih
Created August 23, 2016 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reddikih/0f6035a6013361d163c0b0d92b31ba2e to your computer and use it in GitHub Desktop.
Save reddikih/0f6035a6013361d163c0b0d92b31ba2e to your computer and use it in GitHub Desktop.
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