Exemplo n.º 1
0
  public void parse() {
    usecpluginAAAstore.setdataBroker(dataBroker);
    try {
      getTheNewestFile();
      ParsingLog parsinglog = new ParsingLog();
      parsinglog.start();

    } catch (Exception ioe) {
      ioe.printStackTrace();
    }
  }
Exemplo n.º 2
0
  public void callData() {
    workingDir = System.getProperty("user.dir");
    String fileName =
        workingDir
            + File.separator
            + "data"
            + File.separator
            + "log"
            + File.separator
            + "karaf.log";
    WatchedDir = workingDir + File.separator + "data" + File.separator + "log";
    try {

      LOG.info("log enabled ...");
      Thread.sleep(10000);
      infile = new File(theNewestFile.toString());
      LOG.info("karaf file ..." + theNewestFile);
      Thread.sleep(1000);
      LOG.info("parsing karaf file ...");
      Thread.sleep(9000);
      Scanner scanner = new Scanner(infile);

      while (scanner.hasNext()) {
        line = scanner.nextLine();
        if (line.contains("DEBUG") && line.contains("from")) {

          String phrase1 = line;
          String delims = "[,]+";
          String[] tokens = phrase1.split(delims);
          String phrase2 = line;
          String delims2 = "[|]+";
          String[] tokens2 = phrase2.split(delims2);
          time = tokens[0];
          attempt = tokens2[5];
          String phrase3 = line;
          String[] parts = phrase3.split(" ");
          srcIP = parts[parts.length - 1];
          usecpluginAAAstore.addData(time, srcIP, attempt);
          LOG.info("Information stored in datastore is" + time + " " + srcIP + " " + attempt);
        }
      }
      PublishNotif publishNotif = new PublishNotif();
      publishNotif.setdataBroker(dataBroker);
      publishNotif.Notify();

    } catch (Exception e) {

      e.printStackTrace();
    }
  }