Skip to content

Grok's "break_on_match => false" option does not work #1547

@AlexMonson

Description

@AlexMonson

Logstash v1.4.2, testing on Windows.
Unless I'm misunderstanding what's meant to happen, Grok's break_on_match => false does not work correctly. The second pattern is never matched when the first one is.

CONFIG FILE

input { stdin{} }
filter {
    grok {
        break_on_match => false
        match => [
            "message", "%{GREEDYDATA:name1}beard",
            "message", "tree%{GREEDYDATA:name2}"
        ]
    }
}
output { stdout { codec => rubydebug } }

INPUT1

treebranch

OUTPUT1

{
       "message" => "treebranch\r",
      "@version" => "1",
    "@timestamp" => "2014-07-17T15:31:52.488Z",
          "host" => "hostyhost",
         "name2" => "branch\r"
}

VERDICT1
That was as expected. The first pattern was not matched but the second one was, so the field name2 is created.

INPUT2

bushbeard

OUTPUT2

{
       "message" => "bushbeard\r",
      "@version" => "1",
    "@timestamp" => "2014-07-17T15:33:27.792Z",
          "host" => "hostyhost",
         "name1" => "bush"
}

VERDICT2
That was as expected. The first pattern was matched but the second one was not, so the field name1 is created.

INPUT3

treebeard

OUTPUT3

{
       "message" => "treebeard\r",
      "@version" => "1",
    "@timestamp" => "2014-07-17T15:33:50.543Z",
          "host" => "hostyhost",
         "name1" => "tree"
}

VERDICT3
That was not as expected. The first pattern was matched, so name1 was created properly but then the second pattern was never attempted or failed so name2 is missing.

This is what was expected:

{
       "message" => "treebeard\r",
      "@version" => "1",
    "@timestamp" => "2014-07-17T15:33:50.543Z",
          "host" => "hostyhost",
         "name1" => "tree"
         "name2" => "beard"
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions