Class LogToolUtils

java.lang.Object
org.apache.hadoop.yarn.logaggregation.LogToolUtils

public final class LogToolUtils extends Object
This class contains several utility function which could be used in different log tools.
  • Field Details

  • Method Details

    • outputContainerLog

      public static void outputContainerLog(String containerId, String nodeId, String fileName, long fileLength, long outputSize, String lastModifiedTime, InputStream fis, OutputStream os, byte[] buf, ContainerLogAggregationType logType) throws IOException
      Output container log.
      Parameters:
      containerId - the containerId
      nodeId - the nodeId
      fileName - the log file name
      fileLength - the log file length
      outputSize - the output size
      lastModifiedTime - the log file last modified time
      fis - the log file input stream
      os - the output stream
      buf - the buffer
      logType - the log type.
      Throws:
      IOException - if we can not access the log file.
    • outputContainerLogThroughZeroCopy

      public static void outputContainerLogThroughZeroCopy(String containerId, String nodeId, String fileName, long fileLength, long outputSize, String lastModifiedTime, FileInputStream fis, OutputStream os, ContainerLogAggregationType logType) throws IOException
      Throws:
      IOException
    • createPrintStream

      public static PrintStream createPrintStream(String localDir, String nodeId, String containerId) throws IOException
      Create the container log file under given (local directory/nodeId) and return the PrintStream object.
      Parameters:
      localDir - the Local Dir
      nodeId - the NodeId
      containerId - the ContainerId
      Returns:
      the printStream object
      Throws:
      IOException - if an I/O error occurs
    • getResponseFromNMWebService

      public static javax.ws.rs.core.Response getResponseFromNMWebService(org.apache.hadoop.conf.Configuration conf, javax.ws.rs.client.Client webServiceClient, ContainerLogsRequest request, String logFile)
      Redirect the ContainerLogsRequest to the NodeManager's NMWebServices.
      Parameters:
      conf - Configuration object
      webServiceClient - client
      request - the request for container logs
      logFile - name of the log file
      Returns:
      response from NMWebServices