Last active
February 14, 2019 20:20
-
-
Save delijati/7ba8b378b5c629eb0dbdc126ef197f4e to your computer and use it in GitHub Desktop.
This file contains hidden or 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/bash | |
| set -x | |
| LOCAL_DIR=/home/hadoop/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/yarn_${fields[0]}_${fields[1]}.log | |
| done | |
| if [ -z "$(ls -A $LOCAL_DIR)" ]; then | |
| echo "($LOCAL_DIR) is empty" | |
| else | |
| aws s3 cp $LOCAL_DIR/*.log s3://out/ | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment