Skip to content

Instantly share code, notes, and snippets.

@sunahsuh
Created November 21, 2017 17:50
Show Gist options
  • Save sunahsuh/c051e33545f35ef6fc630256af5d7be1 to your computer and use it in GitHub Desktop.
Save sunahsuh/c051e33545f35ef6fc630256af5d7be1 to your computer and use it in GitHub Desktop.
Download the driver's spark log given a cluster id
# Usage: download_spark_log.sh j-XXXXXXX <optional download path>
# Required: aws cli and jq
cluster=$1
# Optional second argument defaults to .
dlLoc=${2:-\.}
instance=$(aws emr list-instances --cluster-id "$cluster" --instance-group-types MASTER | jq -r '.Instances[0].Ec2InstanceId')
logLocs3n=$(aws emr describe-cluster --cluster-id $cluster | jq -r '.Cluster.LogUri')
logLoc=${logLocs3n//s3n:/s3:}
aws s3 cp "$logLoc$cluster/node/$instance/applications/spark/spark.log.gz" $dlLoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment