Examples of captures()


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

    g.addPatternFromFile("patterns/patterns");
    g.compile("%{QUOTEDSTRING:text}");

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

  }

  @Test
View Full Code Here

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

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

    Match gm = g.match("61243740-4786-11e3-86a7-0002a5d5c51b");
    gm.captures();
    assertEquals("{UUID=61243740-4786-11e3-86a7-0002a5d5c51b}", gm.toMap().toString());

    gm = g.match("7F8C7CB0-4786-11E3-8F96-0800200C9A66");
    gm.captures();
    assertEquals("{UUID=7F8C7CB0-4786-11E3-8F96-0800200C9A66}", gm.toMap().toString());
View Full Code Here

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

    Match gm = g.match("61243740-4786-11e3-86a7-0002a5d5c51b");
    gm.captures();
    assertEquals("{UUID=61243740-4786-11e3-86a7-0002a5d5c51b}", gm.toMap().toString());

    gm = g.match("7F8C7CB0-4786-11E3-8F96-0800200C9A66");
    gm.captures();
    assertEquals("{UUID=7F8C7CB0-4786-11E3-8F96-0800200C9A66}", gm.toMap().toString());

    gm = g.match("03A8413C-F604-4D21-8F4D-24B19D98B5A7");
    gm.captures();
    assertEquals("{UUID=03A8413C-F604-4D21-8F4D-24B19D98B5A7}", gm.toMap().toString());
View Full Code Here

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

    gm = g.match("7F8C7CB0-4786-11E3-8F96-0800200C9A66");
    gm.captures();
    assertEquals("{UUID=7F8C7CB0-4786-11E3-8F96-0800200C9A66}", gm.toMap().toString());

    gm = g.match("03A8413C-F604-4D21-8F4D-24B19D98B5A7");
    gm.captures();
    assertEquals("{UUID=03A8413C-F604-4D21-8F4D-24B19D98B5A7}", gm.toMap().toString());

  }

  @Test
View Full Code Here

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

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

    Match gm = g.match("5E:FF:56:A2:AF:15");
    gm.captures();
    assertEquals("{MAC=5E:FF:56:A2:AF:15}", gm.toMap().toString());

  }

  @Test
View Full Code Here

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

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

    Match gm = g.match("www.google.fr");
    gm.captures();
    assertEquals("{IPORHOST=www.google.fr}", gm.toMap().toString());

    gm = g.match("www.google.com");
    gm.captures();
    assertEquals("{IPORHOST=www.google.com}", gm.toMap().toString());
View Full Code Here

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

    Match gm = g.match("www.google.fr");
    gm.captures();
    assertEquals("{IPORHOST=www.google.fr}", gm.toMap().toString());

    gm = g.match("www.google.com");
    gm.captures();
    assertEquals("{IPORHOST=www.google.com}", gm.toMap().toString());
  }

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

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

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

    Match gm = g.match("www.google.fr:80");
    gm.captures();
    assertEquals("{HOSTPORT=www.google.fr:80, IPORHOST=www.google.fr, PORT=80}", gm.toMap()
        .toString());
  }

  @Test
View Full Code Here

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

    g.addPatternFromFile("patterns/patterns");
    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");
View Full Code Here

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

    assertEquals(gm.toMap().get("timestamp").toString(), "06/Mar/2013:01:36:30 +0900");
    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");
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.