Grok custom pattern problem (Can't start with a number) - Logstash 1.5
- Dominant language
- Java
- Stars
- 14.9k
- Forks
- 3.5k
- Avg merge
- 19h 14m
- Merged PRs (30d)
- 63
Description
Hi,
it was previously OK with Logstash 1.4.2
it now BUG with Logstash 1.5
My pattern file contain a grok pattern with a name starting with a number
Step to reproduce :
1 - Add this pattern to grok patterns :
- 123_DATE %{YEAR:123_date}
- YEAR_DATE %{YEAR:year_date}
2 - Start Logstash with the following commands :
- ./logstash agent -e 'filter { grok { match => ["message","%{123_DATE:year}"] } }'
- ./logstash agent -e 'filter { grok { match => ["message","%{YEAR_DATE:year}"] } }'
3 - RESULTS
- Logstash 1.4.2
[pi@mars logstash-1.4.2/bin]$ ./logstash agent -e 'filter { grok { match => ["message","%{123_DATE:year}"] } }'
2015
{
"message" => "2015",
"@version" => "1",
"@timestamp" => "2015-06-01T08:50:55.018Z",
"type" => "stdin",
"host" => "mars",
"year" => "2015",
"123_date" => "2015"
}
Interrupt received. Shutting down the pipeline. {:level=>:warn}
[pi@mars logstash-1.4.2/bin]$ ./logstash agent -e 'filter { grok { match => ["message","%{YEAR_DATE:year}"] } }'
2015
{
"message" => "2015",
"@version" => "1",
"@timestamp" => "2015-06-01T08:51:13.516Z",
"type" => "stdin",
"host" => "mars",
"year" => "2015",
"year_date" => "2015"
}
- Logstash 1.5
[pi@mars logstash-1.5.0/bin]$ ./logstash agent -e 'filter { grok { match => ["message","%{123_DATE:year}"] } }'
The error reported is:
invalid group name <123_DATE:year>: /(?<123_DATE:year>(?(?>\d\d){1,2}))/m
[pi@mars logstash-1.5.0/bin]$ ./logstash agent -e 'filter { grok { match => ["message","%{YEAR_DATE:year}"] } }'
Logstash startup completed
2015
{
"message" => "2015",
"@version" => "1",
"@timestamp" => "2015-06-01T08:42:46.059Z",
"type" => "stdin",
"host" => "mars",
"year" => "2015",
"year_date" => "2015"
}
Please correct this or just write it somewhere in red inside the documentation.
EDIT : Please note that a name like this : DATE_123_CUSTOM is ok because the name is not starting with a number. (I've just made the test)
M0dM
Contributor guide
Assessment
This issue has not been assessed yet.