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

Add container ECS fields in kubernetes metadata #20984

Merged
merged 13 commits into from
Sep 9, 2020
18 changes: 8 additions & 10 deletions libbeat/autodiscover/providers/kubernetes/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,19 +334,17 @@ func (p *pod) emitEvents(pod *kubernetes.Pod, flag string, containers []kubernet
// This must be an id that doesn't depend on the state of the container
// so it works also on `stop` if containers have been already deleted.
eventID := fmt.Sprintf("%s.%s", pod.GetObjectMeta().GetUID(), c.Name)

cmeta := common.MapStr{
"id": cid,
"name": c.Name,
"image": c.Image,
"runtime": runtimes[c.Name],
}
ChrsMark marked this conversation as resolved.
Show resolved Hide resolved
meta := p.metagen.Generate(pod, metadata.WithFields("container.name", c.Name),
metadata.WithFields("container.image", c.Image))

meta := p.metagen.Generate(
pod,
metadata.WithFields("container.name", c.Name),
metadata.WithFields("container.image", c.Image),
metadata.WithFields("container.id", cid),
metadata.WithFields("container.runtime", runtimes[c.Name]),
jsoriano marked this conversation as resolved.
Show resolved Hide resolved
)

// Information that can be used in discovering a workload
kubemeta := meta.Clone()
kubemeta["container"] = cmeta
kubemeta["annotations"] = annotations
if len(nsAnn) != 0 {
kubemeta["namespace_annotations"] = nsAnn
Expand Down