Skip to content

Instantly share code, notes, and snippets.

@tankchintan
Created March 22, 2016 21:06
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 tankchintan/7b458f0d468ad3b1a2b8 to your computer and use it in GitHub Desktop.
Save tankchintan/7b458f0d468ad3b1a2b8 to your computer and use it in GitHub Desktop.
Fetch MIO server logs.
log_destination_dir=$3
cluster=$1
node_index_start=$2
nodex_index_next=$(($node_index_start+1))
node_type=( master job index )
node_indices=( $node_index_start $nodex_index_next )
fetched_files=( )
for current_node_type in "${node_type[@]}"; do
for current_node_index in "${node_indices[@]}"; do
current_node=$cluster$current_node_index
echo "Fetching log for mio-0001-$current_node_type-$current_node.us-east-1.ooyala.com"
fetched_file_path=$log_destination_dir/server.$current_node_type.$current_node.$(date +"%Y%m%d-%H%M%S").log
scp root@mio-0001-$current_node_type-$current_node.us-east-1.ooyala.com:/nem/logs/jboss/logs/server.log $fetched_file_path
fetched_files+=" $fetched_file_path"
done
done
tar cvf - $fetched_files | gzip -9 - > $log_destination_dir/$cluster.server.$(date +"%Y%m%d-%H%M%S").tar.gz
rm -rf $fetched_files
exit 0
@tankchintan
Copy link
Author

Usage is,

argument 1 i.e. `bpm` is for the cluster name. this is ​*bpm*​ for ​*bpm*​, ​*prod*​ for ​*starhub*​

argument 2 i.e. `1` is for number with which the node index starts. e.g. for starhub that value will be ​*3*​

argument 3 i.e. `.` is destination where all the logs are to be dumped at

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment