@InterfaceAudience.Public @InterfaceStability.Unstable public abstract class LogAggregationFileController extends Object
| Modifier and Type | Field and Description | 
|---|---|
| protected static org.apache.hadoop.fs.permission.FsPermission | APP_DIR_PERMISSIONSPermissions for the Application directory. | 
| protected static org.apache.hadoop.fs.permission.FsPermission | APP_LOG_FILE_UMASKUmask for the log file. | 
| protected org.apache.hadoop.conf.Configuration | conf | 
| protected String | fileControllerName | 
| protected boolean | fsSupportsChmod | 
| protected org.apache.hadoop.fs.Path | remoteRootLogDir | 
| protected String | remoteRootLogDirSuffix | 
| protected int | retentionSize | 
| protected static org.apache.hadoop.fs.permission.FsPermission | TLDIR_PERMISSIONSPermissions for the top level directory under which app directories will be
 created. | 
| Constructor and Description | 
|---|
| LogAggregationFileController() | 
| Modifier and Type | Method and Description | 
|---|---|
| protected String | aggregatedLogSuffix(String fileName)Create the aggregated log suffix. | 
| protected boolean | belongsToAppAttempt(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId,
                   String containerIdStr) | 
| protected boolean | checkExists(org.apache.hadoop.fs.FileSystem fs,
           org.apache.hadoop.fs.Path path,
           org.apache.hadoop.fs.permission.FsPermission fsPerm) | 
| protected void | cleanOldLogs(org.apache.hadoop.fs.Path remoteNodeLogFileForApp,
            org.apache.hadoop.yarn.api.records.NodeId nodeId,
            org.apache.hadoop.security.UserGroupInformation userUgi) | 
| protected void | closePrintStream(OutputStream out) | 
| abstract void | closeWriter()Close the writer. | 
| void | createAppDir(String user,
            org.apache.hadoop.yarn.api.records.ApplicationId appId,
            org.apache.hadoop.security.UserGroupInformation userUgi)Create remote Application directory for log aggregation. | 
| protected void | createDir(org.apache.hadoop.fs.FileSystem fs,
         org.apache.hadoop.fs.Path path,
         org.apache.hadoop.fs.permission.FsPermission fsPerm) | 
| abstract Map<org.apache.hadoop.yarn.api.records.ApplicationAccessType,String> | getApplicationAcls(org.apache.hadoop.fs.Path aggregatedLogPath,
                  org.apache.hadoop.yarn.api.records.ApplicationId appId)Returns ACLs for the application. | 
| abstract String | getApplicationOwner(org.apache.hadoop.fs.Path aggregatedLogPath,
                   org.apache.hadoop.yarn.api.records.ApplicationId appId)Returns the owner of the application. | 
| protected org.apache.hadoop.fs.FileSystem | getFileSystem(org.apache.hadoop.conf.Configuration conf) | 
| org.apache.hadoop.fs.Path | getOlderRemoteAppLogDir(org.apache.hadoop.yarn.api.records.ApplicationId appId,
                       String appOwner)Get the older remote application directory for log aggregation. | 
| org.apache.hadoop.fs.Path | getRemoteAppLogDir(org.apache.hadoop.yarn.api.records.ApplicationId appId,
                  String appOwner)Get the remote application directory for log aggregation. | 
| org.apache.hadoop.fs.Path | getRemoteNodeLogFileForApp(org.apache.hadoop.yarn.api.records.ApplicationId appId,
                          String user,
                          org.apache.hadoop.yarn.api.records.NodeId nodeId)Get the remote aggregated log path. | 
| org.apache.hadoop.fs.Path | getRemoteRootLogDir()Get the remote root log directory. | 
| String | getRemoteRootLogDirSuffix()Get the log aggregation directory suffix. | 
| void | initialize(org.apache.hadoop.conf.Configuration conf,
          String controllerName)Initialize the log file controller. | 
| abstract void | initializeWriter(LogAggregationFileControllerContext context)Initialize the writer. | 
| protected abstract void | initInternal(org.apache.hadoop.conf.Configuration conf)Derived classes initialize themselves using this method. | 
| boolean | isFsSupportsChmod() | 
| abstract void | postWrite(LogAggregationFileControllerContext record)Operations needed after write the log content. | 
| abstract boolean | readAggregatedLogs(ContainerLogsRequest logRequest,
                  OutputStream os)Output container log. | 
| abstract List<ContainerLogMeta> | readAggregatedLogsMeta(ContainerLogsRequest logRequest)Return a list of  ContainerLogMetafor an application
 from Remote FileSystem. | 
| abstract void | renderAggregatedLogsBlock(HtmlBlock.Block html,
                         View.ViewContext context)Render Aggregated Logs block. | 
| void | verifyAndCreateRemoteLogDir()Verify and create the remote log directory. | 
| abstract void | write(AggregatedLogFormat.LogKey logKey,
     AggregatedLogFormat.LogValue logValue)Write the log content. | 
protected static final org.apache.hadoop.fs.permission.FsPermission TLDIR_PERMISSIONS
protected static final org.apache.hadoop.fs.permission.FsPermission APP_DIR_PERMISSIONS
protected static final org.apache.hadoop.fs.permission.FsPermission APP_LOG_FILE_UMASK
protected org.apache.hadoop.conf.Configuration conf
protected org.apache.hadoop.fs.Path remoteRootLogDir
protected String remoteRootLogDirSuffix
protected int retentionSize
protected String fileControllerName
protected boolean fsSupportsChmod
public void initialize(org.apache.hadoop.conf.Configuration conf,
                       String controllerName)
conf - the ConfigurationcontrollerName - the log controller class nameprotected abstract void initInternal(org.apache.hadoop.conf.Configuration conf)
conf - the Configurationpublic org.apache.hadoop.fs.Path getRemoteRootLogDir()
public String getRemoteRootLogDirSuffix()
public abstract void initializeWriter(LogAggregationFileControllerContext context) throws IOException
context - the LogAggregationFileControllerContextIOException - if fails to initialize the writerpublic abstract void closeWriter()
                          throws LogAggregationDFSException
LogAggregationDFSException - if the closing of the writer fails
         (for example due to HDFS quota being exceeded)public abstract void write(AggregatedLogFormat.LogKey logKey, AggregatedLogFormat.LogValue logValue) throws IOException
logKey - the log keylogValue - the log contentIOException - if fails to write the logspublic abstract void postWrite(LogAggregationFileControllerContext record) throws Exception
record - the LogAggregationFileControllerContextException - if anything failsprotected void closePrintStream(OutputStream out)
public abstract boolean readAggregatedLogs(ContainerLogsRequest logRequest, OutputStream os) throws IOException
logRequest - ContainerLogsRequestos - the output streamIOException - if we can not access the log file.public abstract List<ContainerLogMeta> readAggregatedLogsMeta(ContainerLogsRequest logRequest) throws IOException
ContainerLogMeta for an application
 from Remote FileSystem.logRequest - ContainerLogsRequestContainerLogMetaIOException - if there is no available log filepublic abstract void renderAggregatedLogsBlock(HtmlBlock.Block html, View.ViewContext context)
html - the htmlcontext - the ViewContextpublic abstract String getApplicationOwner(org.apache.hadoop.fs.Path aggregatedLogPath, org.apache.hadoop.yarn.api.records.ApplicationId appId) throws IOException
aggregatedLogPath - the aggregatedLog pathappId - the ApplicationIdIOException - if we can not get the application ownerpublic abstract Map<org.apache.hadoop.yarn.api.records.ApplicationAccessType,String> getApplicationAcls(org.apache.hadoop.fs.Path aggregatedLogPath, org.apache.hadoop.yarn.api.records.ApplicationId appId) throws IOException
aggregatedLogPath - the aggregatedLog path.appId - the ApplicationIdIOException - if we can not get the application aclspublic void verifyAndCreateRemoteLogDir()
public void createAppDir(String user, org.apache.hadoop.yarn.api.records.ApplicationId appId, org.apache.hadoop.security.UserGroupInformation userUgi)
user - the userappId - the application IDuserUgi - the UGIprotected org.apache.hadoop.fs.FileSystem getFileSystem(org.apache.hadoop.conf.Configuration conf)
                                                 throws IOException
IOExceptionprotected void createDir(org.apache.hadoop.fs.FileSystem fs,
                         org.apache.hadoop.fs.Path path,
                         org.apache.hadoop.fs.permission.FsPermission fsPerm)
                  throws IOException
IOExceptionprotected boolean checkExists(org.apache.hadoop.fs.FileSystem fs,
                              org.apache.hadoop.fs.Path path,
                              org.apache.hadoop.fs.permission.FsPermission fsPerm)
                       throws IOException
IOExceptionpublic org.apache.hadoop.fs.Path getRemoteNodeLogFileForApp(org.apache.hadoop.yarn.api.records.ApplicationId appId,
                                                            String user,
                                                            org.apache.hadoop.yarn.api.records.NodeId nodeId)
appId - the ApplicationIduser - the Application OwnernodeId - the NodeManager Idpublic org.apache.hadoop.fs.Path getRemoteAppLogDir(org.apache.hadoop.yarn.api.records.ApplicationId appId,
                                                    String appOwner)
                                             throws IOException
appId - the Application IDappOwner - the Application OwnerIOException - if can not find the remote application directorypublic org.apache.hadoop.fs.Path getOlderRemoteAppLogDir(org.apache.hadoop.yarn.api.records.ApplicationId appId,
                                                         String appOwner)
                                                  throws IOException
appId - the Application IDappOwner - the Application OwnerIOException - if can not find the remote application directoryprotected void cleanOldLogs(org.apache.hadoop.fs.Path remoteNodeLogFileForApp,
                            org.apache.hadoop.yarn.api.records.NodeId nodeId,
                            org.apache.hadoop.security.UserGroupInformation userUgi)
protected String aggregatedLogSuffix(String fileName)
fileName - the File Namepublic boolean isFsSupportsChmod()
protected boolean belongsToAppAttempt(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId,
                                      String containerIdStr)
Copyright © 2008–2023 Apache Software Foundation. All rights reserved.