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

Kubernetes logs are not enriched with namespace annotations via add_resource_metadata #24288

Closed
mantipin opened this issue Mar 2, 2021 · 4 comments
Assignees
Labels
Team:Integrations Label for the Integrations team

Comments

@mantipin
Copy link

mantipin commented Mar 2, 2021

Config:

    name: ${NODE_NAME}
    filebeat.registry.flush: 5s
    filebeat.autodiscover:
      providers:
        - type: kubernetes
          hints.enabled: true
          add_resource_metadata:
            namespace:
              include_annotations: ["testing"]
    output.file:
        path: "/tmp/filebeat"
        filename: filebeat
    http.enabled: true
    http.port: 5066

gives us:

{
   "@timestamp":"2021-03-02T10:30:51.913Z",
   "@metadata":{
      "beat":"filebeat",
      "type":"_doc",
      "version":"7.11.0"
   },
   "log":{
      "offset":366702,
      "file":{
         "path":"/var/lib/docker/containers/dd4491afb59cec4c8839bae9e8841750137bc7803c5158cefdd708df144ff4b7/dd4491afb59cec4c8839bae9e8841750137bc7803c5158cefdd708df144ff4b7-json.log"
      }
   },
   "stream":"stderr",
   "message":"2021-03-02 10:30:51.913173 I | etcdserver/api/etcdhttp: /health OK (status code 200)",
   "input":{
      "type":"container"
   },
   "kubernetes":{
      "namespace":"kube-system",
      "labels":{
         "tier":"control-plane",
         "component":"etcd"
      },
      "container":{
         "name":"etcd",
         "image":"k8s.gcr.io/etcd:3.4.13-0"
      },
      "node":{
         "name":"minikube"
      },
      "namespace_uid":"deb1a47a-6931-45cb-83d3-5945db682cb1",
      "namespace_labels":{
         "blabla":"blabla"
      },
      "pod":{
         "name":"etcd-minikube",
         "uid":"fe041f6c-9a0b-4111-871f-df74feff5e91"
      }
   },
   "container":{
      "image":{
         "name":"k8s.gcr.io/etcd:3.4.13-0"
      },
      "runtime":"docker",
      "id":"dd4491afb59cec4c8839bae9e8841750137bc7803c5158cefdd708df144ff4b7"
   },
   "ecs":{
      "version":"1.6.0"
   },
   "host":{
      "name":"minikube"
   },
   "agent":{
      "name":"minikube",
      "type":"filebeat",
      "version":"7.11.0",
      "hostname":"filebeat-kclr9",
      "ephemeral_id":"88808314-092b-4e1c-81fc-b45c120189ca",
      "id":"23eb3d8e-4828-4c79-b48b-69de731520df"
   }
}

namespace's yaml:

apiVersion: v1
kind: Namespace
metadata:
  annotations:
    testing: testing
  creationTimestamp: "2021-02-10T07:55:52Z"
  labels:
    blabla: blabla
  name: kube-system
  resourceVersion: "21374"
  uid: deb1a47a-6931-45cb-83d3-5945db682cb1
spec:
  finalizers:
  - kubernetes
status:
  phase: Active

Annotations from namespaces worked last time on 7.6.0 version, as I tested.

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Mar 2, 2021
@mantipin
Copy link
Author

mantipin commented Mar 2, 2021

And, by the way, there is even no kubernetes.node.hostname, mentioned here - #22189

@andresrc andresrc added the Team:Integrations Label for the Integrations team label Mar 2, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Mar 2, 2021
@tetianakravchenko
Copy link
Contributor

tetianakravchenko commented Dec 24, 2021

hi @mantipin,
this issue should be already fixed by #27045 and should be available in 7.15

@tetianakravchenko tetianakravchenko self-assigned this Dec 24, 2021
@tetianakravchenko
Copy link
Contributor

I will close this issue as it should be fixed, feel free to reopen it if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Integrations Label for the Integrations team
Projects
None yet
Development

No branches or pull requests

4 participants