diff --git a/Godeps b/Godeps index a41d028c8..0a7cc30a5 100644 --- a/Godeps +++ b/Godeps @@ -49,7 +49,7 @@ github.com/shirou/gopsutil dfbb3e40da8d6fcd1aa0d87003e965fe0ca745ea github.com/soniah/gosnmp 5ad50dc75ab389f8a1c9f8a67d3a1cd85f67ed15 github.com/streadway/amqp 63795daa9a446c920826655f26ba31c81c860fd6 github.com/stretchr/testify 4d4bfba8f1d1027c4fdbe371823030df51419987 -github.com/vjeantet/grok 83bfdfdfd1a8146795b28e547a8e3c8b28a466c2 +github.com/vjeantet/grok d73e972b60935c7fec0b4ffbc904ed39ecaf7efe github.com/wvanbergen/kafka bc265fedb9ff5b5c5d3c0fdcef4a819b3523d3ee github.com/wvanbergen/kazoo-go 968957352185472eacb69215fa3dbfcfdbac1096 github.com/yuin/gopher-lua 66c871e454fcf10251c61bf8eff02d0978cae75a diff --git a/plugins/inputs/logparser/grok/grok_test.go b/plugins/inputs/logparser/grok/grok_test.go index 4e0ead6e9..64fb20c43 100644 --- a/plugins/inputs/logparser/grok/grok_test.go +++ b/plugins/inputs/logparser/grok/grok_test.go @@ -687,3 +687,23 @@ func TestTsModder_Rollover(t *testing.T) { } assert.Equal(t, reftime.Add(time.Nanosecond*1000), modt) } + +func TestShortPatternRegression(t *testing.T) { + p := &Parser{ + Patterns: []string{"%{TS_UNIX:timestamp:ts-unix} %{NUMBER:value:int}"}, + CustomPatterns: ` + TS_UNIX %{DAY} %{MONTH} %{MONTHDAY} %{HOUR}:%{MINUTE}:%{SECOND} %{TZ} %{YEAR} + `, + } + require.NoError(t, p.Compile()) + + metric, err := p.ParseLine(`Wed Apr 12 13:10:34 PST 2017 42`) + require.NoError(t, err) + require.NotNil(t, metric) + + require.Equal(t, + map[string]interface{}{ + "value": int64(42), + }, + metric.Fields()) +}