yarn logs 参数如下:
Retrieve logs for completed YARN applications.
usage: yarn logs -applicationId <application ID> [OPTIONS]
general options are:
-am <AM Containers> Prints the AM Container logs for this
application. Specify comma-separated
value to get logs for related AM
Container. For example, If we specify -am
1,2, we will get the logs for the first
AM Container as well as the second AM
Container. To get logs for all AM
Containers, use -am ALL. To get logs for
the latest AM Container, use -am -1. By
default, it will only print out syslog.
Work with -logFiles to get other logs
-appOwner <Application Owner> AppOwner (assumed to be current user if
not specified)
-containerId <Container ID> ContainerId. By default, it will only
print syslog if the application is
runing. Work with -logFiles to get other
logs.
-help Displays help for all commands.
-logFiles <Log File Name> Work with -am/-containerId and specify
comma-separated value to get specified
container log files. Use "ALL" to fetch
all the log files for the container.
-nodeAddress <Node Address> NodeAddress in the format nodename:port
如果我们获取 hive 用户的 application_1635501674014_9264 的 am 的全部日志。
yarn logs -applicationId application_1635501674014_9264 \
-containerId container_1635501674014_9264_01_000001 \
-appOwner hive -nodeAddress ng5131090-core-instance-oa6q4tws-52.novalocal \
> application_1635501674014_9264_am.log
默认是获取所有日志。可以获取某种日志,日志的种类有 directory.info、 launch_container.sh、stderr、stdout、syslog
如果获取 syslog 日志,可以加上 -logfiles 参数(发现 hadoop 2.7 根本没有解析这个参数)
yarn logs -applicationId application_1635501674014_9264 \
-containerId container_1635501674014_9264_01_000001 \
-appOwner hive -nodeAddress ng5131090-core-instance-oa6q4tws-52.novalocal \
-logfiles syslog \
> application_1635501674014_9264_am_syslog.log