Class AggregatedLogFormat.LogReader
java.lang.Object
org.apache.hadoop.yarn.logaggregation.AggregatedLogFormat.LogReader
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
- AggregatedLogFormat
@Public
@Evolving
public static class AggregatedLogFormat.LogReader
extends Object
implements AutoCloseable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Returns ACLs for the application.Returns the owner of the application.org.apache.hadoop.yarn.logaggregation.AggregatedLogFormat.ContainerLogsReadergetContainerLogsReader(ContainerId containerId) Get a ContainerLogsReader to read the logs for the specified container.Read the next key and return the value-stream.static voidreadAcontainerLogs(DataInputStream valueStream, Writer writer) Writes all logs for a single container to the provided writer.static voidreadAcontainerLogs(DataInputStream valueStream, Writer writer, long logUploadedTime) Writes all logs for a single container to the provided writer.static voidreadAContainerLogsForALogType(DataInputStream valueStream, PrintStream out) Keep calling this till you get aEOFExceptionfor getting logs of all types for a single container.static voidreadAContainerLogsForALogType(DataInputStream valueStream, PrintStream out, long logUploadedTime) Keep calling this till you get aEOFExceptionfor getting logs of all types for a single container.static voidreadAContainerLogsForALogType(DataInputStream valueStream, PrintStream out, long logUploadedTime, long bytes) Keep calling this till you get aEOFExceptionfor getting logs of all types for a single container for the specific bytes.static intreadContainerLogsForALogType(DataInputStream valueStream, PrintStream out, long logUploadedTime, List<String> logType) Keep calling this till you get aEOFExceptionfor getting logs of the specific types for a single container.static intreadContainerLogsForALogType(DataInputStream valueStream, PrintStream out, long logUploadedTime, List<String> logType, long bytes) Keep calling this till you get aEOFExceptionfor getting logs of the specific types for a single container.readContainerMetaDataAndSkipData(DataInputStream valueStream)
-
Constructor Details
-
LogReader
- Throws:
IOException
-
-
Method Details
-
getApplicationOwner
Returns the owner of the application.- Returns:
- the application owner.
- Throws:
IOException- if we can not get the application owner.
-
getApplicationAcls
Returns ACLs for the application. An empty map is returned if no ACLs are found.- Returns:
- a map of the Application ACLs.
- Throws:
IOException- if we can not get the application acls.
-
next
Read the next key and return the value-stream.- Parameters:
key- the log key- Returns:
- the valueStream if there are more keys or null otherwise
- Throws:
IOException- if we can not get the dataInputStream for the next key
-
getContainerLogsReader
@Private public org.apache.hadoop.yarn.logaggregation.AggregatedLogFormat.ContainerLogsReader getContainerLogsReader(ContainerId containerId) throws IOException Get a ContainerLogsReader to read the logs for the specified container.- Parameters:
containerId- the containerId- Returns:
- object to read the container's logs or null if the logs could not be found
- Throws:
IOException- if we can not get the container log reader.
-
readAcontainerLogs
public static void readAcontainerLogs(DataInputStream valueStream, Writer writer, long logUploadedTime) throws IOException Writes all logs for a single container to the provided writer.- Parameters:
valueStream- the valueStreamwriter- the log writerlogUploadedTime- the time stamp- Throws:
IOException- if we can not read the container logs.
-
readAcontainerLogs
public static void readAcontainerLogs(DataInputStream valueStream, Writer writer) throws IOException Writes all logs for a single container to the provided writer.- Parameters:
valueStream- the value streamwriter- the log writer- Throws:
IOException- if we can not read the container logs.
-
readAContainerLogsForALogType
public static void readAContainerLogsForALogType(DataInputStream valueStream, PrintStream out, long logUploadedTime) throws IOException Keep calling this till you get aEOFExceptionfor getting logs of all types for a single container.- Parameters:
valueStream- the value streamout- the print streamlogUploadedTime- the time stamp- Throws:
IOException- if we can not read the container log by specifying the container log type.
-
readAContainerLogsForALogType
public static void readAContainerLogsForALogType(DataInputStream valueStream, PrintStream out, long logUploadedTime, long bytes) throws IOException Keep calling this till you get aEOFExceptionfor getting logs of all types for a single container for the specific bytes.- Parameters:
valueStream- the value streamout- the output print streamlogUploadedTime- the log upload time stampbytes- the output size of the log- Throws:
IOException- if we can not read the container log
-
readAContainerLogsForALogType
public static void readAContainerLogsForALogType(DataInputStream valueStream, PrintStream out) throws IOException Keep calling this till you get aEOFExceptionfor getting logs of all types for a single container.- Parameters:
valueStream- the value streamout- the output print stream- Throws:
IOException- if we can not read the container log
-
readContainerLogsForALogType
public static int readContainerLogsForALogType(DataInputStream valueStream, PrintStream out, long logUploadedTime, List<String> logType) throws IOException Keep calling this till you get aEOFExceptionfor getting logs of the specific types for a single container.- Parameters:
valueStream- the value streamout- the output print streamlogUploadedTime- the log uploaded time stamplogType- the given log type- Returns:
- If logType contains fileType, return 1, otherwise return 0.
- Throws:
IOException- if we can not read the container logs
-
readContainerLogsForALogType
public static int readContainerLogsForALogType(DataInputStream valueStream, PrintStream out, long logUploadedTime, List<String> logType, long bytes) throws IOException Keep calling this till you get aEOFExceptionfor getting logs of the specific types for a single container.- Parameters:
valueStream- the value streamout- the output print streamlogUploadedTime- the log uploaded time stamplogType- the given log typebytes- log bytes.- Returns:
- If logType contains fileType, return 1, otherwise return 0.
- Throws:
IOException- if we can not read the container logs
-
readContainerMetaDataAndSkipData
@Private public static org.apache.commons.math3.util.Pair<String,String> readContainerMetaDataAndSkipData(DataInputStream valueStream) throws IOException - Throws:
IOException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-