1 40 41 package org.dspace.app.statistics; 42 43 import org.dspace.app.statistics.LogLine; 44 45 import org.dspace.core.ConfigurationManager; 46 import org.dspace.core.Context; 47 import org.dspace.storage.rdbms.DatabaseManager; 48 import org.dspace.storage.rdbms.TableRow; 49 50 import java.sql.SQLException ; 51 52 import java.lang.Long ; 53 import java.lang.StringBuffer ; 54 55 import java.net.InetAddress ; 56 import java.net.UnknownHostException ; 57 58 import java.text.ParseException ; 59 import java.text.SimpleDateFormat ; 60 61 import java.util.ArrayList ; 62 import java.util.Calendar ; 63 import java.util.Date ; 64 import java.util.GregorianCalendar ; 65 import java.util.HashMap ; 66 import java.util.Iterator ; 67 import java.util.List ; 68 import java.util.Map ; 69 import java.util.regex.Matcher ; 70 import java.util.regex.Pattern ; 71 import java.util.StringTokenizer ; 72 73 import java.io.BufferedReader ; 74 import java.io.BufferedWriter ; 75 import java.io.File ; 76 import java.io.FileReader ; 77 import java.io.FileWriter ; 78 import java.io.IOException ; 79 80 91 public class LogAnalyser 92 { 93 94 98 102 103 private static Map actionAggregator = new HashMap (); 104 105 106 private static Map searchAggregator = new HashMap (); 107 108 109 private static Map userAggregator = new HashMap (); 110 111 112 private static Map itemAggregator = new HashMap (); 113 114 115 private static Map archiveStats = new HashMap (); 116 117 118 private static int warnCount = 0; 119 120 121 private static int lineCount = 0; 122 123 127 128 private static List generalSummary = new ArrayList (); 129 130 131 private static List excludeWords = new ArrayList (); 132 133 134 private static List excludeTypes = new ArrayList (); 135 136 137 private static List excludeChars = new ArrayList (); 138 139 140 private static List itemTypes = new ArrayList (); 141 142 143 private static int searchFloor; 144 145 146 private static int itemFloor; 147 148 149 private static int itemLookup; 150 151 152 private static String userEmail; 153 154 155 private static String url; 156 157 158 private static String name; 159 160 161 private static String hostName; 162 163 164 private static int views = 0; 165 166 170 171 private static Pattern excludeCharRX = null; 172 173 174 private static Pattern handleRX = null; 175 176 177 private static Pattern itemRX = null; 178 179 180 private static Pattern queryRX = null; 181 182 183 private static Pattern collectionRX = null; 184 185 186 private static Pattern communityRX = null; 187 188 189 private static Pattern resultsRX = null; 190 191 192 private static Pattern singleRX = null; 193 194 195 private static Pattern valid13 = null; 196 197 198 private static Pattern valid14 = null; 199 200 201 private static Pattern logRegex = null; 202 203 204 private static Pattern comment = Pattern.compile("^#"); 205 206 207 private static Pattern real = Pattern.compile("^(.+)=(.+)"); 208 209 210 private static Pattern typeRX = null; 211 212 213 private static Pattern wordRX = null; 214 215 219 220 private static Calendar startTime = null; 221 222 226 227 private static String logDir = ConfigurationManager.getProperty("dspace.dir") + 228 File.separator + "log"; 229 230 231 private static String fileTemplate = "dspace\\.log.*"; 232 233 234 private static String configFile = ConfigurationManager.getProperty("dspace.dir") + 235 File.separator + "config" + File.separator + 236 "dstat.cfg"; 237 238 239 private static String outFile = ConfigurationManager.getProperty("dspace.dir") + 240 File.separator + "log" + File.separator + "dstat.dat"; 241 242 243 private static Date startDate = null; 244 245 246 private static Date endDate = null; 247 248 249 private static Date logStartDate = null; 250 251 252 private static Date logEndDate = null; 253 254 255 private static boolean lookUp = false; 256 257 258 262 public static void main(String [] argv) 263 throws Exception , SQLException 264 { 265 startTime = new GregorianCalendar (); 267 268 Context context = new Context(); 270 context.setIgnoreAuthorization(true); 271 272 String myLogDir = null; 274 String myFileTemplate = null; 275 String myConfigFile = null; 276 String myOutFile = null; 277 Date myStartDate = null; 278 Date myEndDate = null; 279 boolean myLookUp = false; 280 281 for (int i = 0; i < argv.length; i++) 283 { 284 if (argv[i].equals("-log")) 285 { 286 myLogDir = argv[i+1]; 287 } 288 289 if (argv[i].equals("-file")) 290 { 291 myFileTemplate = argv[i+1]; 292 } 293 294 if (argv[i].equals("-cfg")) 295 { 296 myConfigFile = argv[i+1]; 297 } 298 299 if (argv[i].equals("-out")) 300 { 301 myOutFile = argv[i+1]; 302 } 303 304 if (argv[i].equals("-help")) 305 { 306 LogAnalyser.usage(); 307 System.exit(0); 308 } 309 310 if (argv[i].equals("-start")) 311 { 312 myStartDate = parseDate(argv[i+1]); 313 } 314 315 if (argv[i].equals("-end")) 316 { 317 myEndDate = parseDate(argv[i+1]); 318 } 319 320 if (argv[i].equals("-lookup")) 321 { 322 myLookUp = true; 323 } 324 } 325 326 processLogs(context, myLogDir, myFileTemplate, myConfigFile, myOutFile, myStartDate, myEndDate, myLookUp); 328 } 329 330 343 public static void processLogs(Context context, String myLogDir, 344 String myFileTemplate, String myConfigFile, 345 String myOutFile, Date myStartDate, 346 Date myEndDate, boolean myLookUp) 347 throws IOException , SQLException 348 { 349 352 if (startTime != null) 354 { 355 startTime = new GregorianCalendar (); 356 } 357 358 setParameters(myLogDir, myFileTemplate, myConfigFile, myOutFile, myStartDate, myEndDate, myLookUp); 360 361 FileReader fr = null; 363 BufferedReader br = null; 364 365 readConfig(configFile); 368 369 setRegex(fileTemplate); 372 373 File [] logFiles = getLogFiles(logDir); 375 376 int i = 0; 378 379 for (i = 0; i < logFiles.length; i++) 386 { 387 Matcher matchRegex = logRegex.matcher(logFiles[i].getName()); 389 if (matchRegex.matches()) 390 { 391 try 394 { 395 fr = new FileReader (logFiles[i].toString()); 396 br = new BufferedReader (fr); 397 } 398 catch (IOException e) 399 { 400 System.out.println("Failed to read log file " + logFiles[i].toString()); 401 System.exit(0); 402 } 403 404 String line = null; 409 while ((line = br.readLine()) != null) 410 { 411 LogLine logLine = getLogLine(line); 413 414 if (logLine != null) 416 { 417 if (logLine.beforeDate(startDate)) 420 { 421 continue; 422 } 423 424 if (logLine.afterDate(endDate)) 425 { 426 break; 427 } 428 429 lineCount++; 431 432 if (startDate == null) 436 { 437 if (logStartDate != null) 438 { 439 if (logLine.beforeDate(logStartDate)) 440 { 441 logStartDate = logLine.getDate(); 442 } 443 } 444 else 445 { 446 logStartDate = logLine.getDate(); 447 } 448 } 449 450 if (endDate == null) 451 { 452 if (logEndDate != null) 453 { 454 if (logLine.afterDate(logEndDate)) 455 { 456 logEndDate = logLine.getDate(); 457 } 458 } 459 else 460 { 461 logEndDate = logLine.getDate(); 462 } 463 } 464 465 if (logLine.isLevel("WARN")) 467 { 468 warnCount++; 471 } 472 473 if (logLine.isAction("search")) 475 { 476 String [] words = analyseQuery(logLine.getParams()); 478 479 for (int j = 0; j < words.length; j++) 482 { 483 searchAggregator.put(words[j], increment(searchAggregator, words[j])); 486 } 487 } 488 489 if (logLine.isAction("login") && !userEmail.equals("off")) 491 { 492 userAggregator.put(logLine.getUser(), increment(userAggregator, logLine.getUser())); 493 } 494 495 if (logLine.isAction("view_item")) 497 { 498 String handle = logLine.getParams(); 499 500 Matcher matchHandle = handleRX.matcher(handle); 502 handle = matchHandle.replaceAll(""); 503 504 Matcher matchItem = itemRX.matcher(handle); 506 handle = matchItem.replaceAll(""); 507 508 handle.trim(); 509 510 itemAggregator.put(handle, increment(itemAggregator, handle)); 513 } 514 515 actionAggregator.put(logLine.getAction(), increment(actionAggregator, logLine.getAction())); 517 } 518 } 519 520 br.close(); 522 fr.close(); 523 524 } 525 } 526 527 archiveStats.put("All Items", getNumItems(context)); 533 for (i = 0; i < itemTypes.size(); i++) 534 { 535 archiveStats.put(itemTypes.get(i), getNumItems(context, (String ) itemTypes.get(i))); 536 } 537 538 try 540 { 541 InetAddress addr = InetAddress.getLocalHost(); 542 hostName = addr.getHostName(); 543 } 544 catch (UnknownHostException e) 545 { 546 hostName = "unknown host"; 547 } 548 549 if (((Integer ) archiveStats.get("All Items")).intValue() != 0) 551 { 552 Double avg = new Double ( 555 Math.ceil( 556 ((Integer ) actionAggregator.get("view_item")).intValue() / 557 ((Integer ) archiveStats.get("All Items")).intValue())); 558 views = avg.intValue(); 559 } 560 561 createOutput(); 563 564 return; 565 } 566 567 568 582 public static void setParameters(String myLogDir, String myFileTemplate, 583 String myConfigFile, String myOutFile, 584 Date myStartDate, Date myEndDate, 585 boolean myLookUp) 586 { 587 if (myLogDir != null) 588 { 589 logDir = myLogDir; 590 } 591 592 if (myFileTemplate != null) 593 { 594 fileTemplate = myFileTemplate; 595 } 596 597 if (myConfigFile != null) 598 { 599 configFile = myConfigFile; 600 } 601 602 if (myStartDate != null) 603 { 604 startDate = myStartDate; 605 } 606 607 if (myEndDate != null) 608 { 609 endDate = myEndDate; 610 } 611 612 if (myLogDir != null) 613 { 614 lookUp = myLookUp; 615 } 616 617 if (myOutFile != null) 618 { 619 outFile = myOutFile; 620 } 621 622 return; 623 } 624 625 626 629 public static void createOutput() 630 { 631 StringBuffer summary = new StringBuffer (); 633 634 Iterator keys = null; 636 637 summary.append("log_lines=" + Integer.toString(lineCount) + "\n"); 639 640 summary.append("warnings=" + Integer.toString(warnCount) + "\n"); 642 643 for (int i = 0; i < generalSummary.size(); i++) 645 { 646 summary.append("general_summary=" + generalSummary.get(i) + "\n"); 647 } 648 649 summary.append("server_name=" + hostName + "\n"); 651 652 summary.append("service_name=" + name + "\n"); 654 655 SimpleDateFormat sdf = new SimpleDateFormat ("dd'/'MM'/'yyyy"); 657 658 if (startDate != null) 659 { 660 summary.append("start_date=" + sdf.format(startDate) + "\n"); 661 } 662 else if (logStartDate != null) 663 { 664 summary.append("start_date=" + sdf.format(logStartDate) + "\n"); 665 } 666 667 if (endDate != null) 668 { 669 summary.append("end_date=" + sdf.format(endDate) + "\n"); 670 } 671 else if (logEndDate != null) 672 { 673 summary.append("end_date=" + sdf.format(logEndDate) + "\n"); 674 } 675 676 keys = archiveStats.keySet().iterator(); 678 while (keys.hasNext()) 679 { 680 String key = (String ) keys.next(); 681 summary.append("archive." + key + "=" + archiveStats.get(key) + "\n"); 682 } 683 684 keys = actionAggregator.keySet().iterator(); 686 while (keys.hasNext()) 687 { 688 String key = (String ) keys.next(); 689 summary.append("action." + key + "=" + actionAggregator.get(key) + "\n"); 690 } 691 692 summary.append("user_email=" + userEmail + "\n"); 695 int address = 1; 696 keys = userAggregator.keySet().iterator(); 697 698 while (keys.hasNext()) 702 { 703 String key = (String ) keys.next(); 704 summary.append("user."); 705 if (userEmail.equals("on")) 706 { 707 summary.append(key + "=" + userAggregator.get(key) + "\n"); 708 } 709 else if (userEmail.equals("alias")) 710 { 711 summary.append("Address " + Integer.toString(address++) + "=" + userAggregator.get(key) + "\n"); 712 } 713 } 714 715 719 summary.append("search_floor=" + searchFloor + "\n"); 721 keys = searchAggregator.keySet().iterator(); 722 while (keys.hasNext()) 723 { 724 String key = (String ) keys.next(); 725 if (((Integer ) searchAggregator.get(key)).intValue() >= searchFloor) 726 { 727 summary.append("search." + key + "=" + searchAggregator.get(key) + "\n"); 728 } 729 } 730 731 738 summary.append("item_floor=" + itemFloor + "\n"); 740 summary.append("host_url=" + url + "\n"); 741 summary.append("item_lookup=" + itemLookup + "\n"); 742 743 keys = itemAggregator.keySet().iterator(); 745 while (keys.hasNext()) 746 { 747 String key = (String ) keys.next(); 748 if (((Integer ) itemAggregator.get(key)).intValue() >= itemFloor) 749 { 750 summary.append("item." + key + "=" + itemAggregator.get(key) + "\n"); 751 } 752 } 753 754 if (views > 0) 756 { 757 summary.append("avg_item_views=" + views + "\n"); 758 } 759 760 Calendar endTime = new GregorianCalendar (); 762 long timeInMillis = (endTime.getTimeInMillis() - startTime.getTimeInMillis()); 763 summary.append("analysis_process_time=" + Long.toString(timeInMillis / 1000) + "\n"); 764 765 try 767 { 768 BufferedWriter out = new BufferedWriter (new FileWriter (outFile)); 769 out.write(summary.toString()); 770 out.close(); 771 } 772 catch (IOException e) 773 { 774 System.out.println("Unable to write to output file " + outFile); 775 System.exit(0); 776 } 777 778 return; 779 } 780 781 782 789 public static File [] getLogFiles(String logDir) 790 { 791 File logs = new File (logDir); 794 795 if (!logs.isDirectory()) 797 { 798 System.out.println("Passed log directory is not a directory"); 799 System.exit(0); 800 } 801 802 return logs.listFiles(); 804 } 805 806 807 815 public static void setRegex(String fileTemplate) 816 { 817 StringBuffer charRegEx = new StringBuffer (); 819 charRegEx.append("["); 820 for (int i = 0; i < excludeChars.size(); i++) 821 { 822 charRegEx.append("\\" + (String ) excludeChars.get(i)); 823 } 824 charRegEx.append("]"); 825 excludeCharRX = Pattern.compile(charRegEx.toString()); 826 827 handleRX = Pattern.compile("handle="); 829 830 itemRX = Pattern.compile(",item_id=.*$"); 832 833 queryRX = Pattern.compile("query="); 835 836 collectionRX = Pattern.compile("collection_id=[0-9]*,"); 838 839 communityRX = Pattern.compile("community_id=[0-9]*,"); 841 842 resultsRX = Pattern.compile(",results=(.*)"); 844 845 singleRX = Pattern.compile("( . |^. | .$)"); 847 848 String logLine13 = "^(\\d\\d\\d\\d-\\d\\d\\-\\d\\d) \\d\\d:\\d\\d:\\d\\d,\\d\\d\\d (\\w+)\\s+\\S+ @ ([^:]+):[^:]+:([^:]+):(.*)"; 850 String logLine14 = "^(\\d\\d\\d\\d-\\d\\d\\-\\d\\d) \\d\\d:\\d\\d:\\d\\d,\\d\\d\\d (\\w+)\\s+\\S+ @ ([^:]+):[^:]+:[^:]+:([^:]+):(.*)"; 851 valid13 = Pattern.compile(logLine13); 852 valid14 = Pattern.compile(logLine14); 853 854 logRegex = Pattern.compile(fileTemplate); 856 857 StringBuffer typeRXString = new StringBuffer (); 859 typeRXString.append("("); 860 for (int i = 0; i < excludeTypes.size(); i++) 861 { 862 if (i > 0) 863 { 864 typeRXString.append("|"); 865 } 866 typeRXString.append((String ) excludeTypes.get(i)); 867 } 868 typeRXString.append(")"); 869 typeRX = Pattern.compile(typeRXString.toString()); 870 871 StringBuffer wordRXString = new StringBuffer (); 873 wordRXString.append("("); 874 for (int i = 0; i < excludeWords.size(); i++) 875 { 876 if (i > 0) 877 { 878 wordRXString.append("|"); 879 } 880 wordRXString.append(" " + (String ) excludeWords.get(i) + " "); 881 wordRXString.append("|"); 882 wordRXString.append("^" + (String ) excludeWords.get(i) + " "); 883 wordRXString.append("|"); 884 wordRXString.append(" " + (String ) excludeWords.get(i) + "$"); 885 } 886 wordRXString.append(")"); 887 wordRX = Pattern.compile(wordRXString.toString()); 888 889 return; 890 } 891 892 893 898 public static void readConfig(String configFile) 899 throws IOException 900 { 901 FileReader fr = null; 903 BufferedReader br = null; 904 905 String record = null; 906 try 907 { 908 fr = new FileReader (configFile); 909 br = new BufferedReader (fr); 910 } 911 catch (IOException e) 912 { 913 System.out.println("Failed to read config file"); 914 System.exit(0); 915 } 916 917 while ((record = br.readLine()) != null) 919 { 920 Matcher matchComment = comment.matcher(record); 922 Matcher matchReal = real.matcher(record); 923 924 if (!matchComment.matches() && matchReal.matches()) 926 { 927 String key = matchReal.group(1).trim(); 929 String value = matchReal.group(2).trim(); 930 931 if (key.equals("general.summary")) 934 { 935 actionAggregator.put(value, new Integer (0)); 936 generalSummary.add(value); 937 } 938 939 if (key.equals("exclude.word")) 940 { 941 excludeWords.add(value); 942 } 943 944 if (key.equals("exclude.type")) 945 { 946 excludeTypes.add(value); 947 } 948 949 if (key.equals("exclude.character")) 950 { 951 excludeChars.add(value); 952 } 953 954 if (key.equals("item.type")) 955 { 956 itemTypes.add(value); 957 } 958 959 if (key.equals("item.floor")) 960 { 961 itemFloor = Integer.parseInt(value); 962 } 963 964 if (key.equals("search.floor")) 965 { 966 searchFloor = Integer.parseInt(value); 967 } 968 969 if (key.equals("item.lookup")) 970 { 971 itemLookup = Integer.parseInt(value); 972 } 973 974 if (key.equals("user.email")) 975 { 976 userEmail = value; 977 } 978 979 if (key.equals("host.url")) 980 { 981 url = value; 982 } 983 984 if (key.equals("host.name")) 985 { 986 name = value; 987 } 988 } 989 } 990 991 br.close(); 993 fr.close(); 994 995 return; 996 } 997 998 1006 public static Integer increment(Map map, String key) 1007 { 1008 Integer newValue = null; 1009 if (map.containsKey(key)) 1010 { 1011 newValue = new Integer (((Integer ) map.get(key)).intValue() + 1); 1013 } 1014 else 1015 { 1016 newValue = new Integer (1); 1017 } 1018 return newValue; 1019 } 1020 1021 1031 public static Date parseDate(String date) 1032 { 1033 SimpleDateFormat sdf = new SimpleDateFormat ("yyyy'-'MM'-'dd"); 1034 Date parsedDate = null; 1035 1036 try 1037 { 1038 parsedDate = sdf.parse(date); 1039 } 1040 catch (ParseException e) 1041 { 1042 System.out.println("The date is not in the correct format"); 1043 System.exit(0); 1044 } 1045 return parsedDate; 1046 } 1047 1048 1049 1056 public static String unParseDate(Date date) 1057 { 1058 SimpleDateFormat sdf = new SimpleDateFormat ("yyyy'-'MM'-'dd"); 1060 return sdf.format(date); 1061 } 1062 1063 1064 1073 public static String [] analyseQuery(String query) 1074 { 1075 int i = 0; 1077 1078 query = query.toLowerCase(); 1081 1082 Matcher matchQuery = queryRX.matcher(query); 1085 query = matchQuery.replaceAll(" "); 1086 1087 Matcher matchCollection = collectionRX.matcher(query); 1088 query = matchCollection.replaceAll(" "); 1089 1090 Matcher matchCommunity = communityRX.matcher(query); 1091 query = matchCommunity.replaceAll(" "); 1092 1093 Matcher matchResults = resultsRX.matcher(query); 1094 query = matchResults.replaceAll(" "); 1095 1096 Matcher matchTypes = typeRX.matcher(query); 1097 query = matchTypes.replaceAll(" "); 1098 1099 Matcher matchChars = excludeCharRX.matcher(query); 1100 query = matchChars.replaceAll(" "); 1101 1102 Matcher matchWords = wordRX.matcher(query); 1103 query = matchWords.replaceAll(" "); 1104 1105 Matcher single = singleRX.matcher(query); 1106 query = single.replaceAll(" "); 1107 1108 StringTokenizer st = new StringTokenizer (query); 1111 String [] words = new String [st.countTokens()]; 1112 for (i = 0; i < words.length; i++) 1113 { 1114 words[i] = st.nextToken().trim(); 1115 } 1116 1117 return words; 1120 } 1121 1122 1123 1130 public static LogLine getLogLine(String line) 1131 { 1132 Matcher match; 1136 1137 if (line.indexOf(":ip_addr") > 0) 1138 { 1139 match = valid14.matcher(line); 1140 } 1141 else 1142 { 1143 match = valid13.matcher(line); 1144 } 1145 1146 if (match.matches()) 1147 { 1148 LogLine logLine = new LogLine(parseDate(match.group(1).trim()), 1150 match.group(2).trim(), 1151 match.group(3).trim(), 1152 match.group(4).trim(), 1153 match.group(5).trim()); 1154 1155 return logLine; 1156 } 1157 else 1158 { 1159 return null; 1160 } 1161 } 1162 1163 1164 1174 public static Integer getNumItems(Context context, String type) 1175 throws SQLException 1176 { 1177 1179 1183 String typeQuery = null; 1185 1186 if (type != null) 1187 { 1188 typeQuery = "SELECT item_id " + 1189 "FROM metadatavalue " + 1190 "WHERE text_value LIKE '%" + type + "%' " + 1191 "AND metadata_field_id = (" + 1192 " SELECT metadata_field_id " + 1193 " FROM metadatafieldregistry " + 1194 " WHERE element = 'type' " + 1195 " AND qualifier IS NULL) "; 1196 } 1197 1198 StringBuffer dateQuery = new StringBuffer (); 1200 dateQuery.append("SELECT item_id " + 1201 "FROM metadatavalue " + 1202 "WHERE metadata_field_id = (" + 1203 " SELECT metadata_field_id " + 1204 " FROM metadatafieldregistry " + 1205 " WHERE element = 'date' " + 1206 " AND qualifier = 'accessioned') "); 1207 1208 if (startDate != null) 1209 { 1210 dateQuery.append(" AND text_value::timestamp > '" + 1211 unParseDate(startDate) + "'::timestamp "); 1212 } 1213 1214 if (endDate != null) 1215 { 1216 dateQuery.append(" AND text_value::timestamp < ' " + 1217 unParseDate(endDate) + "'::timestamp "); 1218 } 1219 1220 StringBuffer query = new StringBuffer (); 1222 1223 query.append("SELECT COUNT(*) AS number " + 1224 "FROM item " + 1225 "WHERE in_archive = true " + 1226 "AND withdrawn = false "); 1227 1228 if (startDate != null || endDate != null) 1229 { 1230 query.append(" AND item_id IN ( " + 1231 dateQuery.toString() + ") "); 1232 } 1233 1234 if (type != null) 1235 { 1236 query.append(" AND item_id IN ( " + 1237 typeQuery + ") "); 1238 } 1239 1240 TableRow row = DatabaseManager.querySingle(context, query.toString()); 1241 1242 Long count = new Long (row.getLongColumn("number")); 1244 return new Integer (count.intValue()); 1245 } 1246 1247 1248 1257 public static Integer getNumItems(Context context) 1258 throws SQLException 1259 { 1260 return getNumItems(context, null); 1261 } 1262 1263 1264 1267 public static void usage() 1268 { 1269 String usage = "Usage Information:\n" + 1270 "LogAnalyser [options [parameters]]\n" + 1271 "-log [log directory]\n" + 1272 "\tOptional\n" + 1273 "\tSpecify a directory containing log files\n" + 1274 "\tDefault uses [dspace.dir]/log from dspace.cfg\n" + 1275 "-file [file name regex]\n" + 1276 "\tOptional\n" + 1277 "\tSpecify a regular expression as the file name template.\n" + 1278 "\tCurrently this needs to be correctly escaped for Java string handling (FIXME)\n" + 1279 "\tDefault uses dspace.log*\n" + 1280 "-cfg [config file path]\n" + 1281 "\tOptional\n" + 1282 "\tSpecify a config file to be used\n" + 1283 "\tDefault uses dstat.cfg in dspace config directory\n" + 1284 "-out [output file path]\n" + 1285 "\tOptional\n" + 1286 "\tSpecify an output file to write results into\n" + 1287 "\tDefault uses dstat.dat in dspace log directory\n" + 1288 "-start [YYYY-MM-DD]\n" + 1289 "\tOptional\n" + 1290 "\tSpecify the start date of the analysis\n" + 1291 "\tIf a start date is specified then no attempt to gather \n" + 1292 "\tcurrent database statistics will be made unless -lookup is\n" + 1293 "\talso passed\n" + 1294 "\tDefault is to start from the earliest date records exist for\n" + 1295 "-end [YYYY-MM-DD]\n" + 1296 "\tOptional\n" + 1297 "\tSpecify the end date of the analysis\n" + 1298 "\tIf an end date is specified then no attempt to gather \n" + 1299 "\tcurrent database statistics will be made unless -lookup is\n" + 1300 "\talso passed\n" + 1301 "\tDefault is to work up to the last date records exist for\n" + 1302 "-lookup\n" + 1303 "\tOptional\n" + 1304 "\tForce a lookup of the current database statistics\n" + 1305 "\tOnly needs to be used if date constraints are also in place\n" + 1306 "-help\n" + 1307 "\tdisplay this usage information\n"; 1308 1309 System.out.println(usage); 1310 } 1311} 1312 | Popular Tags |