@Private public Set<ContainerLogFileInfo> listContainerLogs( ContainerLogsRequest options) throws IOException { List<ContainerLogMeta> containersLogMeta; Set<ContainerLogFileInfo> logTypes = new HashSet<ContainerLogFileInfo>(); try { containersLogMeta = getFileController(options.getAppId(), options.getAppOwner()).readAggregatedLogsMeta( options); } catch (Exception ex) { System.err.println(ex.getMessage()); return logTypes; } for (ContainerLogMeta logMeta: containersLogMeta) { for (ContainerLogFileInfo fileInfo : logMeta.getContainerLogMeta()) { logTypes.add(fileInfo); } } return logTypes; }
@Private public int dumpAllContainersLogs(ContainerLogsRequest options) throws IOException { LogAggregationFileController fc = null; try { fc = this.getFileController( options.getAppId(), options.getAppOwner()); } catch (IOException ex) { System.err.println(ex); } boolean foundAnyLogs = false; if (fc != null) { foundAnyLogs = fc.readAggregatedLogs(options, null); } if (!foundAnyLogs) { emptyLogDir(LogAggregationUtils.getRemoteAppLogDir( conf, options.getAppId(), options.getAppOwner()) .toString()); return -1; } return 0; }
@Private public void printContainersList(ContainerLogsRequest options, PrintStream out, PrintStream err) throws IOException { ApplicationId appId = options.getAppId(); String nodeId = options.getNodeId(); boolean foundAnyLogs = false; List<ContainerLogMeta> containersLogMeta = new ArrayList<>(); try { containersLogMeta = getFileController(options.getAppId(), options.getAppOwner()).readAggregatedLogsMeta( options); } catch (Exception ex) { err.println(ex.getMessage()); } for(ContainerLogMeta logMeta : containersLogMeta) { out.println(String.format(CONTAINER_ON_NODE_PATTERN, logMeta.getContainerId(), logMeta.getNodeId())); foundAnyLogs = true; } if (!foundAnyLogs) { if (nodeId != null) { err.println("Can not find information for any containers on " + nodeId); } else { err.println("Can not find any container information for " + "the application: " + appId); } } }
try { containersLogMeta = getFileController(options.getAppId(), options.getAppOwner()).readAggregatedLogsMeta( options); } catch (Exception ex) {
PrintStream out, PrintStream err) throws IOException { ApplicationId appId = options.getAppId(); String appOwner = options.getAppOwner(); LogAggregationFileController fileFormat = null; try {
@Private @VisibleForTesting public int dumpAContainerLogsForLogType(ContainerLogsRequest options, boolean outputFailure) throws IOException { LogAggregationFileController fc = null; try { fc = this.getFileController( options.getAppId(), options.getAppOwner()); } catch (IOException ex) { System.err.println(ex); } boolean foundAnyLogs = false; if (fc != null) { foundAnyLogs = fc.readAggregatedLogs(options, null); } if (!foundAnyLogs) { if (outputFailure) { containerLogNotFound(options.getContainerId()); } return -1; } return 0; }
System.err.println("Can not get AMContainers logs for " + "the application:" + appId + " with the appOwner:" + request.getAppOwner()); return -1;
@Private public int dumpAContainerLogsForLogTypeWithoutNodeId( ContainerLogsRequest options) throws IOException { LogAggregationFileController fc = null; try { fc = this.getFileController( options.getAppId(), options.getAppOwner()); } catch (IOException ex) { System.err.println(ex); } boolean foundAnyLogs = false; if (fc != null) { foundAnyLogs = fc.readAggregatedLogs(options, null); } if (!foundAnyLogs) { containerLogNotFound(options.getContainerId()); return -1; } return 0; }
String nodeId = logRequest.getNodeId(); ApplicationId appId = logRequest.getAppId(); String appOwner = logRequest.getAppOwner(); boolean getAllContainers = (containerIdStr == null); String nodeIdStr = (nodeId == null) ? null
long size = logRequest.getBytes(); RemoteIterator<FileStatus> nodeFiles = LogAggregationUtils .getRemoteNodeFileDir(conf, appId, logRequest.getAppOwner()); byte[] buf = new byte[65535]; while (nodeFiles != null && nodeFiles.hasNext()) {
System.err.println("Can not find the logs for the application: " + options.getAppId() + " with the appOwner: " + options.getAppOwner());
String nodeId = logRequest.getNodeId(); ApplicationId appId = logRequest.getAppId(); String appOwner = logRequest.getAppOwner(); boolean getAllContainers = (containerIdStr == null || containerIdStr.isEmpty());
long size = logRequest.getBytes(); RemoteIterator<FileStatus> nodeFiles = LogAggregationUtils .getRemoteNodeFileDir(conf, appId, logRequest.getAppOwner(), this.remoteRootLogDir, this.remoteRootLogDirSuffix); if (!nodeFiles.hasNext()) {
String containerIdStr = request.getContainerId(); String nodeAddress = request.getNodeId(); String appOwner = request.getAppOwner(); boolean isAppFinished = request.isAppFinished();
public ContainerLogsRequest(ContainerLogsRequest request) { this.setAppId(request.getAppId()); this.setAppFinished(request.isAppFinished()); this.setAppOwner(request.getAppOwner()); this.setNodeId(request.getNodeId()); this.setNodeHttpAddress(request.getNodeHttpAddress()); this.setContainerId(request.getContainerId()); this.setOutputLocalDir(request.getOutputLocalDir()); this.setLogTypes(request.getLogTypes()); this.setBytes(request.getBytes()); this.setContainerState(request.getContainerState()); }