Created
August 23, 2016 22:47
-
-
Save reddikih/0f6035a6013361d163c0b0d92b31ba2e to your computer and use it in GitHub Desktop.
A simple C* log collect script
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
#!/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