Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick #25037 to 7.x: Add pod.ip in k8s metadata #25062

Merged
merged 1 commit into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add `wineventlog` schema to `decode_xml` processor. {issue}23910[23910] {pull}24726[24726]
- Add new ECS 1.9 field `cloud.service.name` to `add_cloud_metadata` processor. {pull}24993[24993]
- Libbeat: report queue capacity, output batch size, and output client count to monitoring. {pull}24700[24700]
- Add kubernetes.pod.ip field in kubernetes metadata. {pull}25037[25037]

*Auditbeat*

Expand Down
10 changes: 10 additions & 0 deletions auditbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -12395,6 +12395,16 @@ type: keyword

--

*`kubernetes.pod.ip`*::
+
--
Kubernetes Pod IP


type: ip

--

*`kubernetes.namespace`*::
+
--
Expand Down
2 changes: 1 addition & 1 deletion auditbeat/include/fields.go

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions filebeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -87074,6 +87074,16 @@ type: keyword

--

*`kubernetes.pod.ip`*::
+
--
Kubernetes Pod IP


type: ip

--

*`kubernetes.namespace`*::
+
--
Expand Down
2 changes: 1 addition & 1 deletion filebeat/include/fields.go

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions heartbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9977,6 +9977,16 @@ type: keyword

--

*`kubernetes.pod.ip`*::
+
--
Kubernetes Pod IP


type: ip

--

*`kubernetes.namespace`*::
+
--
Expand Down
2 changes: 1 addition & 1 deletion heartbeat/include/fields.go

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions journalbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -10322,6 +10322,16 @@ type: keyword

--

*`kubernetes.pod.ip`*::
+
--
Kubernetes Pod IP


type: ip

--

*`kubernetes.namespace`*::
+
--
Expand Down
2 changes: 1 addition & 1 deletion journalbeat/include/fields.go

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions libbeat/autodiscover/providers/kubernetes/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
},
"node": common.MapStr{
"name": "node",
Expand All @@ -413,6 +414,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
}, "node": common.MapStr{
"name": "node",
},
Expand All @@ -436,6 +438,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
},
"node": common.MapStr{
"name": "node",
Expand All @@ -449,6 +452,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
}, "node": common.MapStr{
"name": "node",
}, "container": common.MapStr{
Expand Down Expand Up @@ -523,6 +527,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
},
"node": common.MapStr{
"name": "node",
Expand All @@ -536,6 +541,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
}, "node": common.MapStr{
"name": "node",
},
Expand All @@ -559,6 +565,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
},
"node": common.MapStr{
"name": "node",
Expand All @@ -572,6 +579,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
}, "node": common.MapStr{
"name": "node",
}, "container": common.MapStr{
Expand Down Expand Up @@ -602,6 +610,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
},
"node": common.MapStr{
"name": "node",
Expand All @@ -615,6 +624,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
}, "node": common.MapStr{
"name": "node",
}, "container": common.MapStr{
Expand Down Expand Up @@ -841,6 +851,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
},
"node": common.MapStr{
"name": "node",
Expand All @@ -854,6 +865,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
}, "node": common.MapStr{
"name": "node",
},
Expand All @@ -877,6 +889,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
},
"node": common.MapStr{
"name": "node",
Expand All @@ -890,6 +903,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
}, "node": common.MapStr{
"name": "node",
}, "container": common.MapStr{
Expand Down Expand Up @@ -947,6 +961,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
},
"node": common.MapStr{
"name": "node",
Expand All @@ -960,6 +975,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
}, "node": common.MapStr{
"name": "node",
},
Expand All @@ -983,6 +999,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
},
"node": common.MapStr{
"name": "node",
Expand All @@ -996,6 +1013,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
}, "node": common.MapStr{
"name": "node",
}, "container": common.MapStr{
Expand Down Expand Up @@ -1057,6 +1075,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
},
"node": common.MapStr{
"name": "node",
Expand All @@ -1070,6 +1089,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
}, "node": common.MapStr{
"name": "node",
},
Expand All @@ -1093,6 +1113,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
},
"node": common.MapStr{
"name": "node",
Expand All @@ -1106,6 +1127,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
}, "node": common.MapStr{
"name": "node",
}, "container": common.MapStr{
Expand Down Expand Up @@ -1169,6 +1191,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
},
"node": common.MapStr{
"name": "node",
Expand All @@ -1182,6 +1205,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
}, "node": common.MapStr{
"name": "node",
},
Expand All @@ -1205,6 +1229,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
},
"node": common.MapStr{
"name": "node",
Expand All @@ -1218,6 +1243,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
}, "node": common.MapStr{
"name": "node",
}, "container": common.MapStr{
Expand Down Expand Up @@ -1312,6 +1338,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
},
"node": common.MapStr{
"name": "node",
Expand All @@ -1325,6 +1352,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
}, "node": common.MapStr{
"name": "node",
},
Expand All @@ -1349,6 +1377,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
},
"node": common.MapStr{
"name": "node",
Expand All @@ -1362,6 +1391,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
}, "node": common.MapStr{
"name": "node",
}, "container": common.MapStr{
Expand Down Expand Up @@ -1393,6 +1423,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
},
"node": common.MapStr{
"name": "node",
Expand All @@ -1406,6 +1437,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
}, "node": common.MapStr{
"name": "node",
}, "container": common.MapStr{
Expand Down Expand Up @@ -1437,6 +1469,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
},
"node": common.MapStr{
"name": "node",
Expand All @@ -1450,6 +1483,7 @@ func TestEmitEvent(t *testing.T) {
"pod": common.MapStr{
"name": "filebeat",
"uid": "005f3b90-4b9d-12f8-acf0-31020a840133",
"ip": podIP,
}, "node": common.MapStr{
"name": "node",
}, "container": common.MapStr{
Expand Down
5 changes: 5 additions & 0 deletions libbeat/common/kubernetes/metadata/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ func (p *pod) Generate(obj kubernetes.Resource, opts ...FieldOptions) common.Map
out.DeepUpdate(meta)
}
}

if po.Status.PodIP != "" {
out.Put("pod.ip", po.Status.PodIP)
}

return out
}

Expand Down
Loading