Use the YARN CLI to View Logs for Applications
Use the YARN CLI to view logs for running application. Configure the log aggregation to aggregate and write out logs for all containers belonging to a single Application grouped by NodeManagers to single log files at a configured location in the file system.
You can access container log
files using the YARN ResourceManager web UI, but more options are available when you use
the yarn logs
CLI command.
View all Log Files for an Application
yarn logs -applicationId <Application ID>
View a Specific Log Type for an Application
yarn logs -applicationId <Application ID> -log_files <log_file_type>
stderr
error
logs:yarn logs -applicationId <Application ID> -log_files stderr
The -logFiles
option also supports Java regular expressions, so the
following format would return all types of log files:
yarn logs -applicationId <Application ID> -log_files .*
View ApplicationMaster Log Files
yarn logs -applicationId <Application ID> -am ALL
yarn logs -applicationId <Application ID> -am 1
List Container IDs
Use the following command format to list all container IDs for an application:
yarn logs -applicationId <Application ID> -show_application_log_info
View Log Files for One Container
yarn logs -applicationId <Application ID> -containerId <Container ID>
Show Container Log File Information
yarn logs -applicationId <Application ID> -show_container_log_infoYou can then use the
-logFiles
option to view a particular log type.View a Portion of the Log Files for One Container
yarn logs -applicationId <Application ID> -containerId <Container ID> -size <bytes>
yarn logs -applicationId <Application ID> -containerId <Container ID> -size 1000
yarn logs -applicationId <Application ID> -containerId <Container ID> -size -1000
Download Logs for an Application
yarn logs -applicationId <Application ID> -out <path_to_local_folder>
The container log files are organized in parent folders labeled with the applicable node ID.
Display Help for YARN Logs
yarn logs
, run the following
command:yarn logs -help