elastic / beats

:tropical_fish: Beats - Lightweight shippers for Elasticsearch & Logstash
https://www.elastic.co/products/beats
Other
12.06k stars 4.89k forks source link

file output - panic when missing 'path' option #39096

Open andrewkroh opened 2 months ago

andrewkroh commented 2 months ago

path is mandatory according to the docs. Beats should not panic when the value is missing. Instead they should emit a clear error message about the problematic configuration.

Version: b0690b5fb9556e670e86be63d5d40fdf44f78849

output.file:
  filename: api-events.ndjson
{
  "@timestamp": "2024-04-19T19:42:33.273-0400",
  "ecs.version": "1.6.0",
  "error": {
    "message": "runtime error: invalid memory address or nil pointer dereference"
  },
  "log.level": "fatal",
  "log.logger": "filebeat",
  "log.origin": {
    "file.line": 212,
    "file.name": "instance/beat.go",
    "function": "github.com/elastic/beats/v7/libbeat/cmd/instance.Run.func1.1"
  },
  "message": "Failed due to panic.",
  "service.name": "filebeat",
  "stack": "github.com/elastic/beats/v7/libbeat/cmd/instance.Run.func1.1\n\tgithub.com/elastic/beats/v7/libbeat/cmd/instance/beat.go:213\nruntime.gopanic\n\truntime/panic.go:914\nruntime.panicmem\n\truntime/panic.go:261\nruntime.sigpanic\n\truntime/signal_unix.go:861\ngithub.com/elastic/beats/v7/libbeat/outputs/fileout.(*PathFormatString).Run\n\tgithub.com/elastic/beats/v7/libbeat/outputs/fileout/pathformatstring.go:47\ngithub.com/elastic/beats/v7/libbeat/outputs/fileout.(*fileOutput).init\n\tgithub.com/elastic/beats/v7/libbeat/outputs/fileout/file.go:74\ngithub.com/elastic/beats/v7/libbeat/outputs/fileout.makeFileout\n\tgithub.com/elastic/beats/v7/libbeat/outputs/fileout/file.go:65\ngithub.com/elastic/beats/v7/libbeat/outputs.Load\n\tgithub.com/elastic/beats/v7/libbeat/outputs/output_reg.go:109\ngithub.com/elastic/beats/v7/libbeat/cmd/instance.(*Beat).createOutput\n\tgithub.com/elastic/beats/v7/libbeat/cmd/instance/beat.go:1262\ngithub.com/elastic/beats/v7/libbeat/cmd/instance.(*Beat).createBeater.(*Beat).makeOutputFactory.func1\n\tgithub.com/elastic/beats/v7/libbeat/cmd/instance/beat.go:1157\ngithub.com/elastic/beats/v7/libbeat/publisher/pipeline.loadOutput\n\tgithub.com/elastic/beats/v7/libbeat/publisher/pipeline/module.go:139\ngithub.com/elastic/beats/v7/libbeat/publisher/pipeline.LoadWithSettings\n\tgithub.com/elastic/beats/v7/libbeat/publisher/pipeline/module.go:95\ngithub.com/elastic/beats/v7/libbeat/cmd/instance.(*Beat).createBeater\n\tgithub.com/elastic/beats/v7/libbeat/cmd/instance/beat.go:391\ngithub.com/elastic/beats/v7/libbeat/cmd/instance.(*Beat).launch\n\tgithub.com/elastic/beats/v7/libbeat/cmd/instance/beat.go:479\ngithub.com/elastic/beats/v7/libbeat/cmd/instance.Run.func1\n\tgithub.com/elastic/beats/v7/libbeat/cmd/instance/beat.go:221\ngithub.com/elastic/beats/v7/libbeat/cmd/instance.Run\n\tgithub.com/elastic/beats/v7/libbeat/cmd/instance/beat.go:222\ngithub.com/elastic/beats/v7/libbeat/cmd.genRunCmd.func1\n\tgithub.com/elastic/beats/v7/libbeat/cmd/run.go:36\ngithub.com/spf13/cobra.(*Command).execute\n\tgithub.com/spf13/cobra@v1.7.0/command.go:944\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\tgithub.com/spf13/cobra@v1.7.0/command.go:1068\ngithub.com/spf13/cobra.(*Command).Execute\n\tgithub.com/spf13/cobra@v1.7.0/command.go:992\nmain.main\n\tgithub.com/elastic/beats/v7/x-pack/filebeat/main.go:22\nruntime.main\n\truntime/proc.go:267"
}
botelastic[bot] commented 2 months ago

This issue doesn't have a Team:<team> label.