Class LogToolUtils
java.lang.Object
org.apache.hadoop.yarn.logaggregation.LogToolUtils
This class contains several utility function which could be used in different
log tools.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic PrintStreamcreatePrintStream(String localDir, String nodeId, String containerId) Create the container log file under given (local directory/nodeId) and return the PrintStream object.static javax.ws.rs.core.ResponsegetResponseFromNMWebService(org.apache.hadoop.conf.Configuration conf, javax.ws.rs.client.Client webServiceClient, ContainerLogsRequest request, String logFile) Redirect theContainerLogsRequestto the NodeManager's NMWebServices.static voidoutputContainerLog(String containerId, String nodeId, String fileName, long fileLength, long outputSize, String lastModifiedTime, InputStream fis, OutputStream os, byte[] buf, ContainerLogAggregationType logType) Output container log.static voidoutputContainerLogThroughZeroCopy(String containerId, String nodeId, String fileName, long fileLength, long outputSize, String lastModifiedTime, FileInputStream fis, OutputStream os, ContainerLogAggregationType logType)
-
Field Details
-
CONTAINER_ON_NODE_PATTERN
- See Also:
-
-
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 containerIdnodeId- the nodeIdfileName- the log file namefileLength- the log file lengthoutputSize- the output sizelastModifiedTime- the log file last modified timefis- the log file input streamos- the output streambuf- the bufferlogType- 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 DirnodeId- the NodeIdcontainerId- 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 theContainerLogsRequestto the NodeManager's NMWebServices.- Parameters:
conf- Configuration objectwebServiceClient- clientrequest- the request for container logslogFile- name of the log file- Returns:
- response from NMWebServices
-