diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java index c9094023ce..ebd5428810 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java @@ -393,7 +393,8 @@ public void printContainerLogsFromRunningApplication(Configuration conf, newOptions.setLogTypes(matchedFiles); Client webServiceClient = Client.create(); - String containerString = "\n\nContainer: " + containerIdStr; + String containerString = "\n\nContainer: " + containerIdStr + " on " + + nodeId; out.println(containerString); out.println(StringUtils.repeat("=", containerString.length())); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestLogsCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestLogsCLI.java index db40b50e14..10047e3833 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestLogsCLI.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestLogsCLI.java @@ -463,6 +463,8 @@ public ContainerReport getContainerReport(String containerIdStr) "Hello container_0_0001_01_000003 in syslog!")); assertTrue(sysOutStream.toString().contains( "Hello container_0_0001_01_000003 in stdout!")); + assertTrue(sysOutStream.toString().contains( + containerId3 + " on " + LogAggregationUtils.getNodeString(nodeId))); sysOutStream.reset(); fs.delete(new Path(remoteLogRootDir), true); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/LogCLIHelpers.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/LogCLIHelpers.java index 26b2b01abc..e2e3b34d80 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/LogCLIHelpers.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/LogCLIHelpers.java @@ -153,7 +153,8 @@ public int dumpAContainersLogsForALogType(ContainerLogsRequest options, AggregatedLogFormat.LogReader reader = null; PrintStream out = createPrintStream(localDir, fileName, containerId); try { - String containerString = "\n\nContainer: " + containerId; + String containerString = "\n\nContainer: " + containerId + " on " + + thisNodeFile.getPath().getName(); out.println(containerString); out.println(StringUtils.repeat("=", containerString.length())); reader = @@ -220,7 +221,7 @@ public int dumpAContainersLogsForALogTypeWithoutNodeId( thisNodeFile.getPath()); out = createPrintStream(localDir, thisNodeFile.getPath().getName(), containerId); - out.println(containerId); + out.println(containerId + " on " + thisNodeFile.getPath().getName()); out.println(StringUtils.repeat("=", containerId.length())); if (logType == null || logType.isEmpty()) { if (dumpAContainerLogs(containerId, reader, out,