diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/LogAggregationIndexedFileController.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/LogAggregationIndexedFileController.java index 02c319eed1..e94a92a6e2 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/LogAggregationIndexedFileController.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/LogAggregationIndexedFileController.java @@ -621,8 +621,8 @@ public class LogAggregationIndexedFileController ApplicationId appId = logRequest.getAppId(); String appOwner = logRequest.getAppOwner(); ApplicationAttemptId appAttemptId = logRequest.getAppAttemptId(); - boolean getAllContainers = ((containerIdStr == null || - containerIdStr.isEmpty()) && appAttemptId != null); + boolean getAllContainers = (containerIdStr == null || + containerIdStr.isEmpty()); String nodeIdStr = (nodeId == null || nodeId.isEmpty()) ? null : LogAggregationUtils.getNodeString(nodeId); RemoteIterator nodeFiles = LogAggregationUtils @@ -667,7 +667,8 @@ public class LogAggregationIndexedFileController for (Entry> log : logMeta .getLogMetas().entrySet()) { String currentContainerIdStr = log.getKey(); - if (!belongsToAppAttempt(appAttemptId, currentContainerIdStr)) { + if (appAttemptId != null && + !belongsToAppAttempt(appAttemptId, currentContainerIdStr)) { continue; } ContainerLogMeta meta = new ContainerLogMeta(