Examples of captures()


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

    logs.add("170.36.40.12");
    logs.add("124.2.84.36");
   
   
    Grok grok = Grok.create("patterns/patterns", "%{IP}");
    List<String> json = grok.captures(logs);
    assertNotNull(json);
    int i = 0;
    for(String elem : json){
      assertNotNull(elem);
      assertEquals(elem, grok.capture(logs.get(i)));
View Full Code Here

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

    logs.add("170.36.40.12");
    logs.add("124.2.84.36");
   
   
    Grok grok = Grok.create("patterns/patterns", "%{IP}");
    List<String> json = grok.captures(logs);
    assertNotNull(json);
    int i = 0;
    for(String elem : json){
      System.out.println(elem);
      assertNotNull(elem);
View Full Code Here

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

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

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

    gm = g.match("john doe");
    gm.captures();
    assertEquals("{USER=john}", gm.toMap().toString());
View Full Code Here

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

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

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

  @Test
  public void test002_numbers() throws Throwable {
View Full Code Here

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

    g.addPatternFromFile("patterns/patterns");
    g.compile("%{NUMBER}");

    Match gm = g.match("-42");
    gm.captures();
    assertEquals("{NUMBER=-42}", gm.toMap().toString());

  }

  @Test
View Full Code Here

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

    g.addPatternFromFile("patterns/patterns");
    g.compile("%{WORD}");

    Match gm = g.match("a");
    gm.captures();
    assertEquals("{WORD=a}", gm.toMap().toString());

    gm = g.match("abc");
    gm.captures();
    assertEquals("{WORD=abc}", gm.toMap().toString());
View Full Code Here

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

    Match gm = g.match("a");
    gm.captures();
    assertEquals("{WORD=a}", gm.toMap().toString());

    gm = g.match("abc");
    gm.captures();
    assertEquals("{WORD=abc}", gm.toMap().toString());

  }

  @Test
View Full Code Here

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

    g.addPatternFromFile("patterns/patterns");
    g.compile("%{SPACE}");

    Match gm = g.match("abc dc");
    gm.captures();
    assertEquals("{SPACE=}", gm.toMap().toString());

  }

  @Test
View Full Code Here

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

    g.addPatternFromFile("patterns/patterns");
    g.compile("%{NUMBER}");

    Match gm = g.match("Something costs $55.4!");
    gm.captures();
    assertEquals("{NUMBER=55.4}", gm.toMap().toString());

  }

  @Test
View Full Code Here

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

    g.addPatternFromFile("patterns/patterns");
    g.compile("%{NOTSPACE}");

    Match gm = g.match("abc dc");
    gm.captures();
    assertEquals("{NOTSPACE=abc}", gm.toMap().toString());

  }

  @Test
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.