# Kubernetes\_metadata does not work on Kubernetes Windows

**URL:** https://discuss.elastic.co/t/kubernetes-metadata-does-not-work-on-kubernetes-windows/245617
**Category:** Beats
**Tags:** filebeat
**Created:** [August 19, 2020, 2:04pm UTC](https://discuss.elastic.co/t/kubernetes-metadata-does-not-work-on-kubernetes-windows/245617 "2020-08-19T14:04:46Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![iusergii](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/iusergii/32/74514_2.png) [@iusergii](https://discuss.elastic.co/u/iusergii)
#### Post date: [August 19, 2020, 2:04pm UTC](https://discuss.elastic.co/t/kubernetes-metadata-does-not-work-on-kubernetes-windows/245617/1 "2020-08-19T14:04:47Z")

</div>

Hi Team,

I'm evaluating moving our Windows workloads to Kubernetes and would like to use filebeat for logs shipment. I've created DaemonSet where I mounted hostPathes:

- /var/log
- /ProgramData/docker/containers

My filebeat configuration looks like:

```auto
filebeat.autodiscover:
  providers:
  - type: kubernetes
    hints:
      enabled: true
      default_config:
        type: container
        paths:
          - "C:\\var\\log\\containers\\*"
output.console:
  pretty: true
processors:
  - add_host_metadata: ~
  - add_cloud_metadata: ~
  - add_kubernetes_metadata: ~
logging:
  level: debug

```

I can confirm that I can read from logs file from container context, but `add_kubernetes_metadata` processor is failing with following errors:

```bash
2020-08-19T13:10:37.084Z DEBUG [input] log/input.go:494 Start harvester for new file: C:\var\log\containers\open-app-8fd9f9fcb-htbs8_default_open-app-09c468ee2146e47ec601e37dccbbabca246ee52dff196b2e573965225149b3ea.log
2020-08-19T13:10:37.138Z ERROR [kubernetes] add_kubernetes_metadata/matchers.go:91 Error extracting container id - source value does not contain matcher's logs_path 'C:\ProgramData\Docker\containers\'.

```

- Version: `filebeat version 7.8.1 (amd64), libbeat 7.8.1 [94f7632be5d56a7928595da79f4b829ffe123744 built 2020-07-21 15:12:43 +0000 UTC]`
- Operating System: `Windows Server 2019 10.0.17763 N/A Build 17763`

---

<div class="post-metadata">

### Author: ![jsoriano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsoriano/32/27920_2.png) [@jsoriano](https://discuss.elastic.co/u/jsoriano)
#### Post date: [August 25, 2020, 4:42pm UTC](https://discuss.elastic.co/t/kubernetes-metadata-does-not-work-on-kubernetes-windows/245617/2 "2020-08-25T16:42:54Z")

</div>

Hey @iusergii welcome to discuss 🙂

I think that the problem is in the `add_kubernetes_metadata` configuration. It thinks that logs are taken from `C:\ProgramData\Docker\containers\`. You need to replace the `matchers` for your logs path, something like this might work:

```auto
  - add_kubernetes_metadata:
      default_matchers.enabled: false
      matchers:
        - logs_path:
            logs_path: 'C:\var\log\containers\'

```

Btw, what docker image are you using to deploy filebeat?

---

<div class="post-metadata">

### Author: ![iusergii](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/iusergii/32/74514_2.png) [@iusergii](https://discuss.elastic.co/u/iusergii)
#### Post date: [August 26, 2020, 6:25am UTC](https://discuss.elastic.co/t/kubernetes-metadata-does-not-work-on-kubernetes-windows/245617/3 "2020-08-26T06:25:12Z")

</div>

Hi @jsoriano, thank you very much, it works.

I'm only testing it so built my own, here is Dockerfile:

```auto
FROM mcr.microsoft.com/windows/servercore:ltsc2019
COPY filebeat-7.9.0-windows-x86_64 /app
ENTRYPOINT ["c:\\app\\filebeat.exe", "-c", "c:\\etc\\filebeat\\filebeat.yml", "-e"]

```

It quite heavy ~ 5GB, would love to move it to NanoServer, but seems there is an issue with libs compatibility: [issue](https://github.com/elastic/beats/issues/19185)

---

<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: [September 23, 2020, 8:25am UTC](https://discuss.elastic.co/t/kubernetes-metadata-does-not-work-on-kubernetes-windows/245617/4 "2020-09-23T08:25:26Z")

</div>

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