Skip to content

Instantly share code, notes, and snippets.

@Punkrex
Last active June 2, 2022 12:17
Show Gist options
  • Select an option

  • Save Punkrex/657a66dcdc85bdd78644 to your computer and use it in GitHub Desktop.

Select an option

Save Punkrex/657a66dcdc85bdd78644 to your computer and use it in GitHub Desktop.
Short script to dump all Yarn logs to a local directory.
#!/bin/sh
LOCAL_DIR=yarn_logs
mkdir $LOCAL_DIR
for row in $( yarn application -appStates ALL -list | awk '/application_/{print $1 "," $2}' )
do
fields=($(echo $row | tr "," "\n"))
yarn logs -applicationId ${fields[0]} > $LOCAL_DIR/${fields[0]}_${fields[1]}.log
done
aws s3 sync $LOCAL_DIR/ s3://ambari-cobrain/ambari-logs/dev/$(date +%h-%y)/$(date +%d-%H:%M)/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment