View Application Logs from the Command Line

About this task

Get the application ID and then view log files for the application.
Get the Application ID
To get the application ID for an application that is in a "running" state, you can run the following command:
yarn application -list
However, if you run yarn application -list after a job completes, the command will not return any information.
To get the application ID for an application in any state (submitted, accepted, or running), run the following command:
yarn application -list -appStates ALL
The yarn appication -list command returns information similar to the following, including the application ID:
20/10/19 14:57:51 INFO client.MapRZKBasedRMFailoverProxyProvider: Updated RM address to node1.cluster.com/192.168.33.11:8032
Total number of applications (application-types: [] and states: [SUBMITTED, ACCEPTED, RUNNING]):1
Application-Id Application-Name Application-Type User Queue State Final-State Progress Tracking-URL
application_1603118361219_0002 QuasiMonteCarlo MAPREDUCE mapr root.mapr ACCEPTED UNDEFINED 0% N/A
View Application Logs
Run the following command to view log files for an application:
yarn logs -applicationId <application-ID>

//Example: yarn logs -applicationId application_1603118361219_0002