Last active
June 2, 2022 12:17
-
-
Save Punkrex/657a66dcdc85bdd78644 to your computer and use it in GitHub Desktop.
Short script to dump all Yarn logs to a local directory.
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/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