# Filebeat is not cleaning old kubernetes log files that were autodiscovered from the registry

**URL:** <https://discuss.elastic.co/t/filebeat-is-not-cleaning-old-kubernetes-log-files-that-were-autodiscovered-from-the-registry/200494>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [September 20, 2019, 8:46pm UTC](https://discuss.elastic.co/t/filebeat-is-not-cleaning-old-kubernetes-log-files-that-were-autodiscovered-from-the-registry/200494 "2019-09-20T20:46:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![carlsoane](https://avatars.discourse-cdn.com/v4/letter/c/ecc23a/32.png) [@carlsoane](https://discuss.elastic.co/u/carlsoane)\
**Post date:** [September 20, 2019, 8:46pm UTC](https://discuss.elastic.co/t/filebeat-is-not-cleaning-old-kubernetes-log-files-that-were-autodiscovered-from-the-registry/200494/1 "2019-09-20T20:46:23Z")

</div>

I have found that filebeat is not cleaning kubernetes autodiscovered log entries from the registry. I verified this by running an ls against each source listed in my filebeat registry file. I found that the vast majority of the files in the registry were autodiscovered log files that no longer existed. I tried adding "clean\_removed" and "close\_removed" to the container config, but this did not make a difference. Here is the autodiscover part of my filebeat.yml file:

```
filebeat.autodiscover:
  providers:
    - type: kubernetes
      templates:
        - config:
            - type: container
              paths:
                - "/var/lib/docker/containers/${data.kubernetes.container.id}/*.log"
              processors:
                - add_kubernetes_metadata:
                    in_cluster: true
                    sync_period: "10m"
                    host: ${NODE_NAME}
                    matchers:
                        - logs_path:
                            logs_path: "/var/lib/docker/containers"
              clean_removed: true
              close_removed: true

```

FYI: This is a similar question to [Controlling harvester settings on kubernetes autodiscovery](https://discuss.elastic.co/t/controlling-harvester-settings-on-kubernetes-autodiscovery/163226) which was closed without an answer.

---

<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:** [October 18, 2019, 8:46pm UTC](https://discuss.elastic.co/t/filebeat-is-not-cleaning-old-kubernetes-log-files-that-were-autodiscovered-from-the-registry/200494/2 "2019-10-18T20:46:23Z")

</div>

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