Package oi.thekraken.grok.api

Examples of oi.thekraken.grok.api.Match.toJson()


    g.compile("%{COMBINEDAPACHELOG}");

    Match gm =
        g.match("112.169.19.192 - - [06/Mar/2013:01:36:30 +0900] \"GET / HTTP/1.1\" 200 44346 \"-\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.152 Safari/537.22\"");
    gm.captures();
    assertNotNull(gm.toJson());
    assertEquals(
        gm.toMap().get("agent").toString(),
        "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.152 Safari/537.22");
    assertEquals(gm.toMap().get("clientip").toString(), "112.169.19.192");
    assertEquals(gm.toMap().get("httpversion").toString(), "1.1");
View Full Code Here


    assertEquals(gm.toMap().get("TIME").toString(), "01:36:30");

    gm =
        g.match("112.169.19.192 - - [06/Mar/2013:01:36:30 +0900] \"GET /wp-content/plugins/easy-table/themes/default/style.css?ver=1.0 HTTP/1.1\" 304 - \"http://www.nflabs.com/\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.152 Safari/537.22\"");
    gm.captures();
    assertNotNull(gm.toJson());
    // System.out.println(gm.toJson());
    assertEquals(
        gm.toMap().get("agent").toString(),
        "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.152 Safari/537.22");
    assertEquals(gm.toMap().get("clientip").toString(), "112.169.19.192");
View Full Code Here

    String line;
    System.out.println("Starting test with ip");
    while ((line = br.readLine()) != null) {
      Match gm = grok.match(line);
      gm.captures();
      assertNotNull(gm.toJson());
      assertNotEquals("{\"Error\":\"Error\"}", gm.toJson());
      assertEquals(gm.toMap().get("IP"), line);
    }
  }
View Full Code Here

    System.out.println("Starting test with ip");
    while ((line = br.readLine()) != null) {
      Match gm = grok.match(line);
      gm.captures();
      assertNotNull(gm.toJson());
      assertNotEquals("{\"Error\":\"Error\"}", gm.toJson());
      assertEquals(gm.toMap().get("IP"), line);
    }
  }

  @Test
View Full Code Here

    String line;
    System.out.println("Starting test with linux messages log -- may take a while");
    while ((line = br.readLine()) != null) {
      Match gm = g.match(line);
      gm.captures();
      assertNotNull(gm.toJson());
      assertNotEquals("{\"Error\":\"Error\"}", gm.toJson());
    }
    br.close();
  }
View Full Code Here

    System.out.println("Starting test with linux messages log -- may take a while");
    while ((line = br.readLine()) != null) {
      Match gm = g.match(line);
      gm.captures();
      assertNotNull(gm.toJson());
      assertNotEquals("{\"Error\":\"Error\"}", gm.toJson());
    }
    br.close();
  }

}
View Full Code Here

    System.out.println("Starting test with httpd log");
    while ((line = br.readLine()) != null) {
      //System.out.println(line);
      Match gm = g.match(line);
      gm.captures();
      assertNotNull(gm.toJson());
      assertNotEquals("{\"Error\":\"Error\"}", gm.toJson());
    }
    br.close();
  }
View Full Code Here

    while ((line = br.readLine()) != null) {
      //System.out.println(line);
      Match gm = g.match(line);
      gm.captures();
      assertNotNull(gm.toJson());
      assertNotEquals("{\"Error\":\"Error\"}", gm.toJson());
    }
    br.close();
  }

  @Test
View Full Code Here

      br = new BufferedReader(new FileReader(LOG_DIR_NASA + child.getName()));
      while ((line = br.readLine()) != null) {
        //System.out.println(child.getName() + " " +line);
        Match gm = g.match(line);
        gm.captures();
        assertNotNull(gm.toJson());
        assertNotEquals("{\"Error\":\"Error\"}", gm.toJson());
      }
      br.close();
    }
  }
View Full Code Here

      while ((line = br.readLine()) != null) {
        //System.out.println(child.getName() + " " +line);
        Match gm = g.match(line);
        gm.captures();
        assertNotNull(gm.toJson());
        assertNotEquals("{\"Error\":\"Error\"}", gm.toJson());
      }
      br.close();
    }
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.