diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index d329e808ec47..cc853aca9c73 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -44,6 +44,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha1...master[Check the HEAD d *Metricbeat* - Fix issue preventing diskio metrics collection for idle disks. {issue}9124[9124] {pull}9125[9125] +- Fix panic on docker healthcheck collection on dockers without healthchecks. {pull}9171[9171] *Packetbeat* diff --git a/metricbeat/module/docker/healthcheck/data.go b/metricbeat/module/docker/healthcheck/data.go index 0b745827600c..dc91093c9186 100644 --- a/metricbeat/module/docker/healthcheck/data.go +++ b/metricbeat/module/docker/healthcheck/data.go @@ -50,6 +50,12 @@ func eventMapping(cont *types.Container, m *MetricSet) common.MapStr { logp.Err("Error inspecting container %v: %v", cont.ID, err) return nil } + + // Check if the container has any health check + if container.State.Health == nil { + return nil + } + lastEvent := len(container.State.Health.Log) - 1 // Checks if a healthcheck already happened