Package oi.thekraken.grok.api

Examples of oi.thekraken.grok.api.Grok.match()


    BufferedReader br = new BufferedReader(new FileReader(LOG_FILE));
    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


    BufferedReader br = new BufferedReader(new FileReader(LOG_FILE));
    String line;
    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

    File dir = new File(LOG_DIR_NASA);
    for (File child : dir.listFiles()) {
      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

  @Test
  public void test001_static_metod_factory() throws Throwable {

    Grok staticGrok = Grok.create("patterns/patterns", "%{USERNAME}");
    Match gm = staticGrok.match("root");
    gm.captures();
    assertEquals("{USERNAME=root}", gm.toMap().toString());

    gm = staticGrok.match("r00t");
    gm.captures();
View Full Code Here

    Grok staticGrok = Grok.create("patterns/patterns", "%{USERNAME}");
    Match gm = staticGrok.match("root");
    gm.captures();
    assertEquals("{USERNAME=root}", gm.toMap().toString());

    gm = staticGrok.match("r00t");
    gm.captures();
    assertEquals("{USERNAME=r00t}", gm.toMap().toString());

    gm = staticGrok.match("guest");
    gm.captures();
View Full Code Here

    gm = staticGrok.match("r00t");
    gm.captures();
    assertEquals("{USERNAME=r00t}", gm.toMap().toString());

    gm = staticGrok.match("guest");
    gm.captures();
    assertEquals("{USERNAME=guest}", gm.toMap().toString());

    gm = staticGrok.match("guest1234");
    gm.captures();
View Full Code Here

    gm = staticGrok.match("guest");
    gm.captures();
    assertEquals("{USERNAME=guest}", gm.toMap().toString());

    gm = staticGrok.match("guest1234");
    gm.captures();
    assertEquals("{USERNAME=guest1234}", gm.toMap().toString());

    gm = staticGrok.match("john doe");
    gm.captures();
View Full Code Here

    gm = staticGrok.match("guest1234");
    gm.captures();
    assertEquals("{USERNAME=guest1234}", gm.toMap().toString());

    gm = staticGrok.match("john doe");
    gm.captures();
    assertEquals("{USERNAME=john}", gm.toMap().toString());
  }

View Full Code Here

    days.add("Sun");
    days.add("Sunday");

    int i = 0;
    for(String day : days){
      Match m = grok.match(day);
      m.captures();
      assertNotNull(m.toMap());
      assertEquals(m.toMap().get("DAY"), days.get(i));
      i++;
    }
View Full Code Here

    BufferedReader br = new BufferedReader(new FileReader("src/test/resources/ip"));
    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

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.