logstash/logstash — pull request #397 by Spredzy (2013-03-10 15:27:59+00:00)
Title: Grok captures name even when matching the whole line

As of today when the grok capture matches the whole line, the named capture is skipped.

The error was related by a user on the [google group](https://groups.google.com/forum/?fromgroups=#!topic/logstash-users/RdNwjmO-wn4) last week

So using this configuration file :

input {
stdin {
type => "myin"
}
}

filter {
grok {
type => "myin"
pattern => "%{DATE_EU:test}"
}
}

output {
stdout {
debug => true
debug_format => "json"
}
}

will always result in an empty `@fields` element. This commit fixes that.

**Before**

`{"@source":"stdin://kibana/","@tags":[],"@fields":{},"@timestamp":"2013-03-10T15:14:38.137Z","@source_host":"kibana","@source_path":"/","@message":"2011/01/01","@type":"myin"}`

**After**

`{"@source":"stdin://kibana/","@tags":[],"@fields":{"test":["2011/01/01"]},"@timestamp":"2013-03-10T15:08:18.330Z","@source_host":"kibana","@source_path":"/","@message":"2011/01/01","@type":"myin"}`

Also a spec test has been added, I did not manage to find out how to run the test suite, but based on what the other test are making it should work correctly.