|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dspace.app.statistics.LogAnalyser
public class LogAnalyser
This class performs all the actual analysis of a given set of DSpace log files. Most input can be configured; use the -help flag for a full list of usage information. The output of this file is plain text and forms an "aggregation" file which can then be used for display purposes using the related ReportGenerator class.
| Constructor Summary | |
|---|---|
LogAnalyser()
|
|
| Method Summary | |
|---|---|
static String[] |
analyseQuery(String query)
Take a search query string and pull out all of the meaningful information from it, giving the results in the form of a String array, a single word to each element |
static void |
createOutput()
generate the analyser's output to the specified out file |
static String |
getConfigFile()
get the current config file name |
static File[] |
getLogFiles(String logDir)
get an array of file objects representing the passed log directory |
static LogLine |
getLogLine(String line)
split the given line into it's relevant segments if applicable (i.e. |
static Integer |
getNumItems(Context context)
get the total number of items in the archive at time of execution, ignoring all other constraints |
static Integer |
getNumItems(Context context,
String type)
get the number of items in the archive which were accessioned between the provided start and end dates, with the given value for the DC field 'type' (unqualified) |
static Integer |
increment(Map<String,Integer> map,
String key)
increment the value of the given map at the given key by one. |
static void |
main(String[] argv)
main method to be run from command line. |
static Date |
parseDate(String date)
Take the standard date string requested at the command line and convert it into a Date object. |
static void |
processLogs(Context context,
String myLogDir,
String myFileTemplate,
String myConfigFile,
String myOutFile,
Date myStartDate,
Date myEndDate,
boolean myLookUp)
using the pre-configuration information passed here, analyse the logs and produce the aggregation file |
static void |
readConfig()
Read in the current config file and populate the class globals. |
static void |
readConfig(String configFile)
Read in the given config file and populate the class globals. |
static void |
setParameters(String myLogDir,
String myFileTemplate,
String myConfigFile,
String myOutFile,
Date myStartDate,
Date myEndDate,
boolean myLookUp)
set the passed parameters up as global class variables. |
static void |
setRegex(String fileTemplate)
set up the regular expressions to be used by this analyser. |
static String |
unParseDate(Date date)
Take the date object and convert it into a string of the form YYYY-MM-DD |
static void |
usage()
print out the usage information for this class to the standard out |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LogAnalyser()
| Method Detail |
|---|
public static void main(String[] argv)
throws Exception,
SQLException
Exception
SQLException
public static void processLogs(Context context,
String myLogDir,
String myFileTemplate,
String myConfigFile,
String myOutFile,
Date myStartDate,
Date myEndDate,
boolean myLookUp)
throws IOException,
SQLException
context - the DSpace context object this occurs undermyLogDir - the passed log directory. Uses default if nullmyFileTemplate - the passed file name regex. Uses default if nullmyConfigFile - the DStat config file. Uses default if nullmyOutFile - the file to which to output aggregation data. Uses default if nullmyStartDate - the desired start of the analysis. Starts from the beginning otherwisemyEndDate - the desired end of the analysis. Goes to the end otherwisemyLookUp - force a lookup of the database
IOException
SQLException
public static void setParameters(String myLogDir,
String myFileTemplate,
String myConfigFile,
String myOutFile,
Date myStartDate,
Date myEndDate,
boolean myLookUp)
myLogDir - the log file directory to be analysedmyFileTemplate - regex for log file namesmyConfigFile - config file to use for dstatmyOutFile - file to write the aggregation intomyStartDate - requested log reporting start datemyEndDate - requested log reporting end datemyLookUp - requested look up force flagpublic static void createOutput()
public static File[] getLogFiles(String logDir)
logDir - the log directory in which to pick up files
public static void setRegex(String fileTemplate)
fileTemplate - the regex to be used to identify dspace log filespublic static String getConfigFile()
public static void readConfig()
throws IOException
IOException
public static void readConfig(String configFile)
throws IOException
configFile - the config file to read in
IOException
public static Integer increment(Map<String,Integer> map,
String key)
map - the map whose value we want to increasekey - the key of the map whose value to increase
public static Date parseDate(String date)
date - the string representation of the date
public static String unParseDate(Date date)
date - the date to be converted
public static String[] analyseQuery(String query)
query - the search query to be analysed
public static LogLine getLogLine(String line)
line - the line to be segmented
public static Integer getNumItems(Context context,
String type)
throws SQLException
context - the DSpace context for the actiontype - value for DC field 'type' (unqualified)
SQLException
public static Integer getNumItems(Context context)
throws SQLException
context - the DSpace context the action is being performed in
SQLExceptionpublic static void usage()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||