Class LogServlet

java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.yarn.server.webapp.LogServlet
All Implemented Interfaces:
org.apache.hadoop.conf.Configurable

public class LogServlet extends org.apache.hadoop.conf.Configured
Extracts aggregated logs and related information. Used by various WebServices (AHS, ATS).
  • Constructor Details

    • LogServlet

      public LogServlet(org.apache.hadoop.conf.Configuration conf, AppInfoProvider appInfoProvider)
  • Method Details

    • getNMWebAddressFromRM

      @VisibleForTesting public String getNMWebAddressFromRM(String nodeId) throws org.codehaus.jettison.json.JSONException
      Throws:
      org.codehaus.jettison.json.JSONException
    • getRemoteLogDirPath

      public javax.ws.rs.core.Response getRemoteLogDirPath(String user, String applicationId) throws IOException
      Returns the user qualified path name of the remote log directory for each pre-configured log aggregation file controller.
      Parameters:
      user - remoteUser.
      applicationId - applicationId.
      Returns:
      Response object containing remote log dir path names
      Throws:
      IOException - if there are I/O errors.
    • getLogsInfo

      public javax.ws.rs.core.Response getLogsInfo(javax.servlet.http.HttpServletRequest hsr, String appIdStr, String appAttemptIdStr, String containerIdStr, String nmId, boolean redirectedFromNode, boolean manualRedirection)
    • getContainerLogsInfo

      public javax.ws.rs.core.Response getContainerLogsInfo(javax.servlet.http.HttpServletRequest req, org.apache.hadoop.yarn.logaggregation.ExtendedLogMetaRequest.ExtendedLogMetaRequestBuilder logsRequest) throws IOException
      Throws:
      IOException
    • getContainerLogsInfo

      public javax.ws.rs.core.Response getContainerLogsInfo(javax.servlet.http.HttpServletRequest req, WrappedLogMetaRequest.Builder builder, String nmId, boolean redirectedFromNode, String clusterId, boolean manualRedirection)
      Returns information about the logs for a specific container.
      Parameters:
      req - the HttpServletRequest
      builder - builder instance for the log meta request
      nmId - NodeManager id
      redirectedFromNode - whether the request was redirected
      clusterId - the id of the cluster
      manualRedirection - whether to return a response with a Location instead of an automatic redirection
      Returns:
      Response object containing information about the logs
    • getLogFile

      public javax.ws.rs.core.Response getLogFile(javax.servlet.http.HttpServletRequest req, String containerIdStr, String filename, String format, String size, String nmId, boolean redirectedFromNode, String clusterId, boolean manualRedirection)
      Returns an aggregated log file belonging to a container.
      Parameters:
      req - the HttpServletRequest
      containerIdStr - container id
      filename - the name of the file
      format - the format of the response
      size - the size of bytes of the log file that should be returned
      nmId - NodeManager id
      redirectedFromNode - whether the request was redirected
      clusterId - the id of the cluster
      manualRedirection - whether to return a response with a Location instead of an automatic redirection
      Returns:
      Response object containing information about the logs
    • createRequestFromContainerId

      public static WrappedLogMetaRequest.Builder createRequestFromContainerId(String containerIdStr)