# Add\_kubernetes\_metadata with input type log

**URL:** <https://discuss.elastic.co/t/add-kubernetes-metadata-with-input-type-log/261448>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [January 18, 2021, 3:49pm UTC](https://discuss.elastic.co/t/add-kubernetes-metadata-with-input-type-log/261448 "2021-01-18T15:49:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vladimir\_Rimar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vladimir_rimar/32/82446_2.png) [@Vladimir\_Rimar](https://discuss.elastic.co/u/Vladimir_Rimar)\
**Post date:** [January 18, 2021, 3:49pm UTC](https://discuss.elastic.co/t/add-kubernetes-metadata-with-input-type-log/261448/1 "2021-01-18T15:49:08Z")

</div>

I'm using filebeat as a side-car container, having input type log. I have also configured:

```auto
    processors:
        - add_kubernetes_metadata:
            in_cluster: true

```

but I'm not getting any metadata like pod, namespace in Elastic. Is this possible with input type log?

---

<div class="post-metadata">

**Author:** ![mtojek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mtojek/32/63863_2.png) [@mtojek](https://discuss.elastic.co/u/mtojek)\
**Post date:** [January 19, 2021, 9:22am UTC](https://discuss.elastic.co/t/add-kubernetes-metadata-with-input-type-log/261448/2 "2021-01-19T09:22:53Z")

</div>

Your Kubernetes configuration might be slightly different. Could you double-check if container logs are collected in `/var/lib/docker/containers/` ?

---

<div class="post-metadata">

**Author:** ![Vladimir\_Rimar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vladimir_rimar/32/82446_2.png) [@Vladimir\_Rimar](https://discuss.elastic.co/u/Vladimir_Rimar)\
**Post date:** [January 19, 2021, 9:50am UTC](https://discuss.elastic.co/t/add-kubernetes-metadata-with-input-type-log/261448/3 "2021-01-19T09:50:14Z")

</div>

I'm using a side-car container in OpenShift, so the logs are not in `/var/lib/docker/containers/`  
Here the input configuration

```auto
filebeat.inputs:
- type: log
  paths:
    - /opt/eap/standalone/log/server.log

```

---

<div class="post-metadata">

**Author:** ![mtojek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mtojek/32/63863_2.png) [@mtojek](https://discuss.elastic.co/u/mtojek)\
**Post date:** [January 19, 2021, 10:04am UTC](https://discuss.elastic.co/t/add-kubernetes-metadata-with-input-type-log/261448/4 "2021-01-19T10:04:55Z")

</div>

Could you try to set. the `logs_path`? For reference: [https://www.elastic.co/guide/en/beats/filebeat/current/add-kubernetes-metadata.html#\_logs\_path](https://www.elastic.co/guide/en/beats/filebeat/current/add-kubernetes-metadata.html#_logs_path)

---

<div class="post-metadata">

**Author:** ![Vladimir\_Rimar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vladimir_rimar/32/82446_2.png) [@Vladimir\_Rimar](https://discuss.elastic.co/u/Vladimir_Rimar)\
**Post date:** [January 19, 2021, 1:32pm UTC](https://discuss.elastic.co/t/add-kubernetes-metadata-with-input-type-log/261448/5 "2021-01-19T13:32:12Z")

</div>

Well, just to make it clear, the log:  
in `/opt/eap/standalone/log/server.log`  
doesn't contain any kubernetes metadata. That is the application server log.

I'm trying to do quite a simple thing. I have a pod in which two containers are running ( application container and a filebeat container ). The pod defines also a few labels, like app-name, deploymentConfig name etc. I have also tried to do somethig like:

```auto
- add_kubernetes_metadata:
        default_indexers.enabled: false
        default_matchers.enabled: false
        include_labels:
          - app-name

```

but that is also not working. I don't see a field app-name in elastic.

I can think of workaround that I set an environment variable(s) for filebeat container with namesapce and pod name, and then add them in the filebeat.yml:

```auto
fields:
    COMPANY_ID: Red_Hat
    APP_NAME: "hello-world"
    namespace: ${NAMESPACE}
    podname: ${PODNAME}

```

but I would expect that this can be done differently.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 16, 2021, 3:32pm UTC](https://discuss.elastic.co/t/add-kubernetes-metadata-with-input-type-log/261448/6 "2021-02-16T15:32:12Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
