Note: This is a regresion as 1.20 works as expected.
Relevent telegraf.conf
[[inputs.tail]]
files = ['/var/log/nginx/access.log']
from_beginning = false
name_override = "foobar"
grok_timezone = "UTC"
data_format = "grok"
grok_patterns = [ "%{CLIENT:client_ip} %{NOTSPACE:ident} %{NOTSPACE:auth} \\[%{HTTPDATE}\\] \"(?:%{WORD:verb:tag} %{NOTSPACE:request}(?: HTTP/%{NUMBER:http_version:float})?|%{DATA})\" %{NUMBER:resp_code:tag} (?:%{NUMBER:resp_bytes:int}|-) %{QS:referrer} %{QS:agent} %{NUMBER:request_time:float} %{NUMBER:upstream_response_time:float} %{NOTSPACE:pipelined}" ]
System info
Telegraf 1.21, Ubuntu 18.04.
Steps to reproduce
- Install telegraf 1.21 (from .deb)
- Use the config above.
- Start telegraf
...
Expected behavior
Telegraf should just process and forward the logs.
Actual behavior
Telegraf crashes with the following:
2021-12-16T09:26:26Z I! Starting Telegraf 1.21.0
2021-12-16T09:26:26Z I! Loaded inputs: cpu disk diskio exec (3x) kernel mem net nginx phpfpm (3x) ping (2x) postfix processes swap system tail
2021-12-16T09:26:26Z I! Loaded aggregators:
2021-12-16T09:26:26Z I! Loaded processors:
2021-12-16T09:26:26Z I! Loaded outputs: influxdb
2021-12-16T09:26:26Z I! Tags enabled: host=foobar
2021-12-16T09:26:26Z I! [agent] Config: Interval:1m0s, Quiet:false, Hostname:"xxx" Flush Interval:10s
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x7c8b5f]
goroutine 52 [running]:
github.com/influxdata/telegraf/plugins/parsers/grok.(*Parser).ParseLine(0xc000154000, {0xc000374fc0, 0x114})
/go/src/github.com/influxdata/telegraf/plugins/parsers/grok/parser.go:213 +0x2ff
github.com/influxdata/telegraf/plugins/parsers/grok.(*Parser).Parse(0x0, {0xc000374ea0, 0x114, 0x120})
/go/src/github.com/influxdata/telegraf/plugins/parsers/grok/parser.go:386 +0x15c
github.com/influxdata/telegraf/plugins/inputs/tail.parseLine({0x577f6b0, 0xc000154000}, {0xc000374d80, 0x0})
/go/src/github.com/influxdata/telegraf/plugins/inputs/tail/tail.go:303 +0x10f
github.com/influxdata/telegraf/plugins/inputs/tail.(*Tail).receiver(0xc000892000, {0x577f6b0, 0xc000154000}, 0xc00017a790)
/go/src/github.com/influxdata/telegraf/plugins/inputs/tail/tail.go:371 +0x4f4
github.com/influxdata/telegraf/plugins/inputs/tail.(*Tail).tailNewFiles.func2()
/go/src/github.com/influxdata/telegraf/plugins/inputs/tail/tail.go:275 +0x85
created by github.com/influxdata/telegraf/plugins/inputs/tail.(*Tail).tailNewFiles
/go/src/github.com/influxdata/telegraf/plugins/inputs/tail/tail.go:273 +0x7af
Additional info
No response
Note: This is a regresion as 1.20 works as expected.
Relevent telegraf.conf
System info
Telegraf 1.21, Ubuntu 18.04.
Steps to reproduce
...
Expected behavior
Telegraf should just process and forward the logs.
Actual behavior
Telegraf crashes with the following:
Additional info
No response