Skip to content

Telegraf 1.21.0 - segmentation violation when using logparser #10286

@hluaces

Description

@hluaces

Relevent telegraf.conf

[global_tags]

[agent]
  interval = "15s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = ""
  debug = false
  quiet = false
  logfile = ""
  hostname = ""
  omit_hostname = false

System info

CentOS 7, Telegraf 1.21.0 (git: HEAD efa6522)

Docker

The Docker file is here:

https://github.com/hluaces/telegraf-bug-1.21.0

Please see the README.md for instructions on reproducing the error.

Steps to reproduce

See the linked Dockerfile for instructions on how to reproduce.

Apparently the tail input seems to be failing when parsing logs. This did not happen in the 1.20 branches.

Expected behavior

Logs should be parsed without unexpected failures.

Actual behavior

Telegraf is failing with an error.

Additional info

This is the error output:

2021-12-16T10:11:13Z I! Starting Telegraf 1.21.0
2021-12-16T10:11:13Z I! Loaded inputs: tail
2021-12-16T10:11:13Z I! Loaded aggregators:
2021-12-16T10:11:13Z I! Loaded processors:
2021-12-16T10:11:13Z I! W! Outputs are not used in testing mode!
2021-12-16T10:11:13Z I! Tags enabled: host=30c097b3ff33
2021-12-16T10:11:13Z D! [agent] Initializing plugins
2021-12-16T10:11:13Z D! [agent] Starting service inputs
2021-12-16T10:11:13Z D! [inputs.tail] Tail added for "/usr/local/cpanel/logs/spamd_error_log"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x7c8b5f]

goroutine 72 [running]:
github.com/influxdata/telegraf/plugins/parsers/grok.(*Parser).ParseLine(0xc0004821e0, {0xc0000bcee0, 0x68})
    /go/src/github.com/influxdata/telegraf/plugins/parsers/grok/parser.go:213 +0x2ff
github.com/influxdata/telegraf/plugins/parsers/grok.(*Parser).Parse(0x44ab40, {0xc0000bce70, 0x68, 0x70})
    /go/src/github.com/influxdata/telegraf/plugins/parsers/grok/parser.go:386 +0x15c
github.com/influxdata/telegraf/plugins/inputs/tail.parseLine({0x577f6b0, 0xc0004821e0}, {0xc0000bd1f0, 0x0})
    /go/src/github.com/influxdata/telegraf/plugins/inputs/tail/tail.go:303 +0x10f
github.com/influxdata/telegraf/plugins/inputs/tail.(*Tail).receiver(0xc0001af600, {0x577f6b0, 0xc0004821e0}, 0xc0007266e0)
    /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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/tailbugunexpected problem or unintended behaviorregressionsomething that used to work, but is now broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions