Skip to content

Commit

Permalink
Cherry-pick #11247 to 7.0: Don't collect empty ip addresses in docker…
Browse files Browse the repository at this point in the history
… container metricset (#11293)

Docker containers can have empty ip addresses if they are running in
host network mode or if they are stopped. Collecting lists with empty
addresses can make type mapping to fail when trying to store them as ip
addresses.

Fix #11225

(cherry picked from commit 258c1c8)
  • Loading branch information
jsoriano committed Mar 19, 2019
1 parent 12dc33a commit 6a0f8ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ https://github.com/elastic/beats/compare/v7.0.0-beta1...master[Check the HEAD di

- Fix errors in filebeat Zeek dashboard and README files. Add notice.log support. {pull}10916[10916]
- Fix a bug when converting NetFlow fields to snake_case. {pull}10950[10950]
- Add on_failure handler for Zeek ingest pipelines. Fix one field name error for notice and add an additional test
case. {issue}11004[11004] {pull}11105[11105]
- Add on_failure handler for Zeek ingest pipelines. Fix one field name error for notice and add an additional test case. {issue}11004[11004] {pull}11105[11105]
- Fix issue preventing docker container events to be stored if the container has a network interface without ip address. {issue}11225[11225] {pull}11247[11247]
- Change URLPATH grok pattern to support brackets. {issue}11135[11135] {pull}11252[11252]
- Add support for iis log with different address format. {issue}11255[11255] {pull}11256[11256]

Expand Down
4 changes: 3 additions & 1 deletion metricbeat/module/docker/container/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ func eventMapping(r mb.ReporterV2, cont *types.Container, dedot bool) {
func extractIPAddresses(networks *types.SummaryNetworkSettings) []string {
ipAddresses := make([]string, 0, len(networks.Networks))
for _, network := range networks.Networks {
ipAddresses = append(ipAddresses, network.IPAddress)
if len(network.IPAddress) > 0 {
ipAddresses = append(ipAddresses, network.IPAddress)
}
}
return ipAddresses
}

0 comments on commit 6a0f8ec

Please sign in to comment.