From 94b194ab28310d026641a87e0209a2140b4feed0 Mon Sep 17 00:00:00 2001 From: Prabhu Joseph Date: Thu, 20 Jun 2019 20:35:26 +0530 Subject: [PATCH] YARN-9451. Fix AggregatedLogsBlock shows wrong NM http port. --- .../org/apache/hadoop/yarn/webapp/log/AggregatedLogsBlock.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/log/AggregatedLogsBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/log/AggregatedLogsBlock.java index ef6876a..ce313b0 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/log/AggregatedLogsBlock.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/log/AggregatedLogsBlock.java @@ -32,6 +32,7 @@ import org.apache.hadoop.yarn.logaggregation.LogAggregationWebUtils; import org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileController; import org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileControllerFactory; +import org.apache.hadoop.yarn.webapp.util.WebAppUtils; import org.apache.hadoop.yarn.webapp.view.HtmlBlock; import com.google.inject.Inject; @@ -129,6 +130,14 @@ private String getApplicationLogURL(ApplicationId applicationId) { StringBuilder sb = new StringBuilder(); String scheme = YarnConfiguration.useHttps(this.conf) ? "https://": "http://"; + + String webAppURLWithoutScheme = + WebAppUtils.getNMWebAppURLWithoutScheme(conf); + if (webAppURLWithoutScheme.contains(":")) { + String httpPort = webAppURLWithoutScheme.split(":")[1]; + nodeId = NodeId.fromString(nodeId).getHost() + ":" + httpPort; + } + sb.append(scheme).append(nodeId).append("/node/application/").append(appId); return sb.toString(); } -- 2.7.4 (Apple Git-66)