# Filebeat in Kubernetes does not inclue Kubernetes metadata on node restart

**URL:** https://discuss.elastic.co/t/filebeat-in-kubernetes-does-not-inclue-kubernetes-metadata-on-node-restart/213019
**Category:** Beats
**Tags:** docker
**Created:** [December 25, 2019, 3:22pm UTC](https://discuss.elastic.co/t/filebeat-in-kubernetes-does-not-inclue-kubernetes-metadata-on-node-restart/213019 "2019-12-25T15:22:13Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Andrii\_Litvinov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrii_litvinov/32/45475_2.png) [@Andrii\_Litvinov](https://discuss.elastic.co/u/Andrii_Litvinov)
#### Post date: [December 25, 2019, 3:22pm UTC](https://discuss.elastic.co/t/filebeat-in-kubernetes-does-not-inclue-kubernetes-metadata-on-node-restart/213019/1 "2019-12-25T15:22:13Z")

</div>

I am running filebeat in k8s cluster with one etcd/control plane and one worker nodes. My filebeat configuration looks as follows:

```auto
setup.ilm.enabled: false
filebeat.inputs:
- type: container
  paths:
    - /var/log/containers/mongodb-*.log
  processors:
    - add_kubernetes_metadata:
        host: ${NODE_NAME}
        matchers:
        - logs_path:
            logs_path: "/var/log/containers/"
  json:
    keys_under_root: true
    overwrite_keys: true
    add_error_key: true
    ignore_decoding_error: true

processors:
  - add_cloud_metadata:
  - add_host_metadata:

output.elasticsearch:
  hosts: ['https://${ELASTICSEARCH_HOST:elasticsearch}:${ELASTICSEARCH_PORT:9200}']
  username: ${ELASTICSEARCH_USERNAME}
  password: ${ELASTICSEARCH_PASSWORD}
  indices:
    - index: filebeat-%{[agent.version]}-%{[kubernetes.container.name]}-%{+yyyy.MM.dd}

```

Basically I configured it to send logs of each container in each pod to dedicated index with `kubernetes.container.name` property. All works fine when cluster is up and running, but when I restart both VMs filebeat does not get any k8s metadata at first and sends logs to default `filebeat-%{[agent.version]}-%{+yyyy.MM.dd}`, which is not what I would expect from this configuration. Is it some sort of bug that I should report to [https://github.com/elastic/beats](https://github.com/elastic/beats) or had I misconfigured it? Is it valid supported configuration of filebeat to send logs to dedicated indexes?

---

<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: [January 22, 2020, 5:22pm UTC](https://discuss.elastic.co/t/filebeat-in-kubernetes-does-not-inclue-kubernetes-metadata-on-node-restart/213019/2 "2020-01-22T17:22:19Z")

</div>

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