Package alluxio.cli.bundler.command
Class CollectLogCommand
- java.lang.Object
-
- alluxio.cli.bundler.command.AbstractCollectInfoCommand
-
- alluxio.cli.bundler.command.CollectLogCommand
-
- All Implemented Interfaces:
alluxio.cli.Command,java.io.Closeable,java.lang.AutoCloseable
public class CollectLogCommand extends AbstractCollectInfoCommand
Command to collect Alluxio logs.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringADDITIONAL_OPTION_NAMEstatic java.lang.StringCOMMAND_NAMEstatic java.lang.StringEXCLUDE_OPTION_NAMEstatic java.util.Set<java.lang.String>FILE_NAMES_PREFIXESstatic java.lang.StringINCLUDE_OPTION_NAMEstatic org.apache.commons.cli.OptionsOPTIONS-
Fields inherited from class alluxio.cli.bundler.command.AbstractCollectInfoCommand
mFsContext, mWorkingDirPath
-
-
Constructor Summary
Constructors Constructor Description CollectLogCommand(alluxio.client.file.FileSystemContext fsContext)Creates a new instance ofCollectLogCommand.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetCommandName()java.lang.StringgetDescription()java.lang.StringgetUsage()static java.time.LocalDateTimeinferFileStartTime(java.io.File f)Infer the starting time of a log file by parsing the log entries from the beginning.static java.time.LocalDateTimeparseDateTime(java.lang.String s)Identifies the datetime from a certain piece of log by trying various known patterns.intrun(org.apache.commons.cli.CommandLine cl)-
Methods inherited from class alluxio.cli.bundler.command.AbstractCollectInfoCommand
generateOutputFile, getWorkingDirectory, validateArgs
-
-
-
-
Field Detail
-
COMMAND_NAME
public static final java.lang.String COMMAND_NAME
- See Also:
- Constant Field Values
-
FILE_NAMES_PREFIXES
public static final java.util.Set<java.lang.String> FILE_NAMES_PREFIXES
-
INCLUDE_OPTION_NAME
public static final java.lang.String INCLUDE_OPTION_NAME
- See Also:
- Constant Field Values
-
EXCLUDE_OPTION_NAME
public static final java.lang.String EXCLUDE_OPTION_NAME
- See Also:
- Constant Field Values
-
ADDITIONAL_OPTION_NAME
public static final java.lang.String ADDITIONAL_OPTION_NAME
- See Also:
- Constant Field Values
-
OPTIONS
public static final org.apache.commons.cli.Options OPTIONS
-
-
Constructor Detail
-
CollectLogCommand
public CollectLogCommand(alluxio.client.file.FileSystemContext fsContext)
Creates a new instance ofCollectLogCommand.- Parameters:
fsContext- theFileSystemContextto execute in
-
-
Method Detail
-
getCommandName
public java.lang.String getCommandName()
-
run
public int run(org.apache.commons.cli.CommandLine cl) throws alluxio.exception.AlluxioException, java.io.IOException- Throws:
alluxio.exception.AlluxioExceptionjava.io.IOException
-
inferFileStartTime
public static java.time.LocalDateTime inferFileStartTime(java.io.File f) throws java.io.FileNotFoundExceptionInfer the starting time of a log file by parsing the log entries from the beginning. It will try the first certain lines with various known datetime patterns.- Parameters:
f- log file- Returns:
- the parsed datetime
- Throws:
java.io.FileNotFoundException
-
getUsage
public java.lang.String getUsage()
-
getDescription
public java.lang.String getDescription()
-
parseDateTime
@Nullable public static java.time.LocalDateTime parseDateTime(java.lang.String s)
Identifies the datetime from a certain piece of log by trying various known patterns. Returns null if unable to identify a datetime.- Parameters:
s- a log entry- Returns:
- identified datetime
-
-