|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
stella.log.LogParser
public class LogParser
This class parses the output of a syslogger file to a more useful object type. It produces a list of logline, which consist of a date a log level, possible a host name and a log message.
| Nested Class Summary | |
|---|---|
static class |
LogParser.Tail
Test reading from a remote host. |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
static DateFormat |
DEFDATEFORMAT
Default property value. |
private static boolean |
DEFHASHOST
Default property value. |
static String |
KEY_DATEFORMAT
The date format used in the log. |
static String |
KEY_HASHOST
If true, a host name follows the log level. |
| Fields inherited from class util.PropertyBundles |
|---|
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES |
| Fields inherited from class util.PropertyResources |
|---|
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset |
| Fields inherited from class util.PropertyContainer |
|---|
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR |
| Fields inherited from interface util.ResourceSupplying |
|---|
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Fields inherited from interface util.PropertySupplying |
|---|
CONFIG, KEY_CLASS |
| Constructor Summary | |
|---|---|
LogParser(Map<String,String> prop)
Constructs a new log parser. |
|
| Method Summary | |
|---|---|
static List<LogLine> |
dateFilter(List<LogLine> log,
Date start,
Date end)
Filters the log levels from starting to ending date, inclusevely on both edges. |
static List<LogLine> |
dateFilter(List<LogLine> log,
Date start,
Date end,
boolean inv)
Filters the log levels from starting to ending date, inclusevely on both edges. |
static List<LogLine> |
dateFilter(List<LogLine> log,
Date start,
long ms)
Returns a date-filtered list starting from the stated date and spanning for the indicated length in ms. |
static List<LogLine> |
dateFilter(List<LogLine> log,
Date start,
long ms,
boolean inv)
Returns a date-filtered list starting from the stated date and spanning for the indicated length in ms. |
static List<LogLine> |
dateFilter(List<LogLine> log,
long ms,
Date end)
Returns a date-filtered list ending at the stated date and spanning previously for the indicated length in ms. |
static List<LogLine> |
dateFilter(List<LogLine> log,
long ms,
Date end,
boolean inv)
Returns a date-filtered list ending at the stated date and spanning previously for the indicated length in ms. |
static List<LogLine> |
levelFilter(List<LogLine> log,
int level)
Filters the list of log lines to contain only the requested levels. |
List<LogLine> |
read(InputStream f)
Parses a log file to a list of logline objects, from an input stream. |
List<LogLine> |
read(InputStream f,
boolean head)
Parses a log file to a list of logline objects. |
List<LogLine> |
readFile(File f)
Parses a log file to a list of logline objects. |
List<LogLine> |
readFile(File f,
boolean head)
Parses a log file to a list of logline objects. |
List<LogLine> |
readList(List<String> lines,
boolean head)
Parses a log file to a list of logline objects. |
static List<LogLine> |
readTail(File f,
int n,
boolean head,
DateFormat df,
boolean host)
Reads log line as tail from a (big) input file. |
static List<LogLine> |
sshTail(String userhost,
File f,
int n,
boolean head,
DateFormat df,
boolean host)
Reads a log line from a remote host using ssh tail command. |
| Methods inherited from class util.PropertyBundles |
|---|
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource |
| Methods inherited from class util.PropertyResources |
|---|
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, init, keyCreate, keyCreate, reload, setApplet |
| Methods inherited from class util.PropertyContainer |
|---|
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface util.ResourceSupplying |
|---|
getResource, getResourceAsStream, getResources |
| Methods inherited from interface util.PropertySupplying |
|---|
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties |
| Methods inherited from interface util.Initializable |
|---|
init |
| Field Detail |
|---|
public static final String KEY_DATEFORMAT
public static final String KEY_HASHOST
public static final DateFormat DEFDATEFORMAT
private static final boolean DEFHASHOST
| Constructor Detail |
|---|
public LogParser(Map<String,String> prop)
| Method Detail |
|---|
public List<LogLine> read(InputStream f)
throws ParseException
ParseException
public List<LogLine> read(InputStream f,
boolean head)
throws ParseException
ParseException
public List<LogLine> readFile(File f)
throws ParseException
ParseException
public List<LogLine> readFile(File f,
boolean head)
throws ParseException
ParseException
public List<LogLine> readList(List<String> lines,
boolean head)
throws ParseException
ParseException
public static List<LogLine> levelFilter(List<LogLine> log,
int level)
The argumental list is not altered by this method.
public static List<LogLine> dateFilter(List<LogLine> log,
long ms,
Date end)
public static List<LogLine> dateFilter(List<LogLine> log,
long ms,
Date end,
boolean inv)
public static List<LogLine> dateFilter(List<LogLine> log,
Date start,
long ms)
public static List<LogLine> dateFilter(List<LogLine> log,
Date start,
long ms,
boolean inv)
public static List<LogLine> dateFilter(List<LogLine> log,
Date start,
Date end)
start - The minimum date or null for any.end - The maximum date or null for any.
public static List<LogLine> dateFilter(List<LogLine> log,
Date start,
Date end,
boolean inv)
start - The minimum date or null for any.end - The maximum date or null for any.inv - If true, exclude all logs in the range.
public static List<LogLine> readTail(File f,
int n,
boolean head,
DateFormat df,
boolean host)
throws ParseException,
IOException
ParseException
IOException
public static List<LogLine> sshTail(String userhost,
File f,
int n,
boolean head,
DateFormat df,
boolean host)
throws ParseException,
IOException
userhost - user and host in form 'user@host'f - Name of the remote file to tailn - number of tail lines, 0 for defaulthead - If true, only main lines are recordeddf - The date format in the file or null if defaulthost - If false, log file does not contain host information. Defaults
to true
ParseException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||