diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 65e2dbe017d3..cdf8d58d31cf 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -434,6 +434,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Add interval information to `monitor` metricset in azure. {pull}22152[22152] - Change Session ID type from int to string {pull}22359[22359] - Fix filesystem types on Windows in filesystem metricset. {pull}22531[22531] +- Fix failiures caused by custom beat names with more than 15 characters {pull}22550[22550] *Packetbeat* diff --git a/libbeat/cmd/instance/metrics.go b/libbeat/cmd/instance/metrics.go index 24d3d12e3e19..2e727446d5db 100644 --- a/libbeat/cmd/instance/metrics.go +++ b/libbeat/cmd/instance/metrics.go @@ -43,6 +43,12 @@ func init() { func setupMetrics(name string) error { monitoring.NewFunc(systemMetrics, "cpu", reportSystemCPUUsage, monitoring.Report) + //if the beat name is longer than 15 characters, truncate it so we don't fail process checks later on + // On *nix, the process name comes from /proc/PID/stat, which uses a comm value of 16 bytes, plus the null byte + if (runtime.GOOS == "linux" || runtime.GOOS == "darwin") && len(name) > 15 { + name = name[:15] + } + beatProcessStats = &process.Stats{ Procs: []string{name}, EnvWhitelist: nil,