Class LogWebService

java.lang.Object
org.apache.hadoop.yarn.server.webapp.LogWebService
All Implemented Interfaces:
AppInfoProvider

@Singleton @Path("/ws/v2/applicationlog") public class LogWebService extends Object implements AppInfoProvider
Support only ATSv2 client only.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.hadoop.yarn.server.webapp.BasicAppInfo
    getApp(javax.servlet.http.HttpServletRequest req, String appId, String clusterId)
    Returns BasicAppInfo object that wraps the collected information about the application.
    javax.ws.rs.core.Response
    getContainerLogFile(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, String containerIdStr, String filename, String format, String size, String nmId, boolean redirectedFromNode, String clusterId, boolean manualRedirection)
    Returns the contents of a container's log file in plain text.
    javax.ws.rs.core.Response
    getContainerLogsInfo(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, String containerIdStr, String nmId, boolean redirectedFromNode, String clusterId, boolean manualRedirection)
    Returns log file's name as well as current file size for a container.
    protected org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity
    getEntity(String path, javax.ws.rs.core.MultivaluedMap<String,String> params)
     
    javax.ws.rs.core.Response
    getLogs(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, String containerIdStr, String filename, String format, String size, String nmId, boolean redirectedFromNode, String clusterId, boolean manualRedirection)
     
    getNodeHttpAddress(javax.servlet.http.HttpServletRequest req, String appId, String appAttemptId, String containerId, String clusterId)
    Returns the node HTTP address.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LogWebService

      public LogWebService()
  • Method Details

    • getContainerLogsInfo

      @GET @Path("/containers/{containerid}/logs") @Produces({"application/json","application/xml"}) public javax.ws.rs.core.Response getContainerLogsInfo(@Context javax.servlet.http.HttpServletRequest req, @Context javax.servlet.http.HttpServletResponse res, @PathParam("containerid") String containerIdStr, @QueryParam("nm.id") String nmId, @QueryParam("redirected_from_node") @DefaultValue("false") boolean redirectedFromNode, @QueryParam("clusterid") String clusterId, @QueryParam("manual_redirection") @DefaultValue("false") boolean manualRedirection)
      Returns log file's name as well as current file size for a container.
      Parameters:
      req - HttpServletRequest
      res - HttpServletResponse
      containerIdStr - The container ID
      nmId - The Node Manager NodeId
      redirectedFromNode - Whether this is a redirected request from NM
      clusterId - clusterId the id of the cluster
      manualRedirection - whether to return a response with a Location instead of an automatic redirection
      Returns:
      The log file's name and current file size
    • getNodeHttpAddress

      public String getNodeHttpAddress(javax.servlet.http.HttpServletRequest req, String appId, String appAttemptId, String containerId, String clusterId)
      Description copied from interface: AppInfoProvider
      Returns the node HTTP address.
      Specified by:
      getNodeHttpAddress in interface AppInfoProvider
      Parameters:
      req - HttpServletRequest associated with the request
      appId - the id of the application
      appAttemptId - the id of the application attempt
      containerId - the container id
      clusterId - the id of the cluster
      Returns:
      the node HTTP address
    • getApp

      public org.apache.hadoop.yarn.server.webapp.BasicAppInfo getApp(javax.servlet.http.HttpServletRequest req, String appId, String clusterId)
      Description copied from interface: AppInfoProvider
      Returns BasicAppInfo object that wraps the collected information about the application.
      Specified by:
      getApp in interface AppInfoProvider
      Parameters:
      req - HttpServletRequest associated with the request
      appId - the id of the application
      clusterId - the id of the cluster
      Returns:
      BasicAppInfo object
    • getContainerLogFile

      @GET @Path("/containers/{containerid}/logs/{filename}") @Produces("text/plain") @Public @Unstable public javax.ws.rs.core.Response getContainerLogFile(@Context javax.servlet.http.HttpServletRequest req, @Context javax.servlet.http.HttpServletResponse res, @PathParam("containerid") String containerIdStr, @PathParam("filename") String filename, @QueryParam("format") String format, @QueryParam("size") String size, @QueryParam("nm.id") String nmId, @QueryParam("redirected_from_node") boolean redirectedFromNode, @QueryParam("clusterid") String clusterId, @QueryParam("manual_redirection") @DefaultValue("false") boolean manualRedirection)
      Returns the contents of a container's log file in plain text.
      Parameters:
      req - HttpServletRequest
      res - HttpServletResponse
      containerIdStr - The container ID
      filename - The name of the log file
      format - The content type
      size - the size of the log file
      nmId - The Node Manager NodeId
      redirectedFromNode - Whether this is the redirect request from NM
      clusterId - the id of the cluster
      manualRedirection - whether to return a response with a Location instead of an automatic redirection
      Returns:
      The contents of the container's log file
    • getLogs

      @GET @Path("/containerlogs/{containerid}/{filename}") @Produces("text/plain; charset=utf-8") @Public @Unstable public javax.ws.rs.core.Response getLogs(@Context javax.servlet.http.HttpServletRequest req, @Context javax.servlet.http.HttpServletResponse res, @PathParam("containerid") String containerIdStr, @PathParam("filename") String filename, @QueryParam("format") String format, @QueryParam("size") String size, @QueryParam("nm.id") String nmId, @QueryParam("redirected_from_node") @DefaultValue("false") boolean redirectedFromNode, @QueryParam("clusterid") String clusterId, @QueryParam("manual_redirection") @DefaultValue("false") boolean manualRedirection)
    • getEntity

      @VisibleForTesting protected org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity getEntity(String path, javax.ws.rs.core.MultivaluedMap<String,String> params) throws IOException
      Throws:
      IOException