# Autodiscover not working

**URL:** <https://discuss.elastic.co/t/autodiscover-not-working/335522>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [June 8, 2023, 9:46am UTC](https://discuss.elastic.co/t/autodiscover-not-working/335522 "2023-06-08T09:46:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vijayakumar\_Kannan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vijayakumar_kannan/32/34873_2.png) [@Vijayakumar\_Kannan](https://discuss.elastic.co/u/Vijayakumar_Kannan)\
**Post date:** [June 8, 2023, 9:46am UTC](https://discuss.elastic.co/t/autodiscover-not-working/335522/1 "2023-06-08T09:46:02Z")

</div>

Greetiings,

We enable auto discover with following and it harvest logs from all pods.

```auto
filebeat.autodiscover: 
  providers:
    - type: kubernetes
      hints.enabled: true
      hints.default_config: 
        type: container
        paths:
          - /var/log/containers/*-${data.container.id}.log

```

If i want to harvest the logs where annotation enabled from pod level with following config doesn't work

```auto
filebeat.autodiscover: 
  providers:
    - type: kubernetes
      hints.enabled: true
      hints.default_config.enabled: false

```

in both scenario pod annotation present.

---

<div class="post-metadata">

**Author:** ![Andreas\_Gkizas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andreas_gkizas/32/117035_2.png) [@Andreas\_Gkizas](https://discuss.elastic.co/u/Andreas_Gkizas)\
**Post date:** [June 8, 2023, 11:12am UTC](https://discuss.elastic.co/t/autodiscover-not-working/335522/2 "2023-06-08T11:12:30Z")

</div>

Hello,

This is the config that works for me for 8.8.0:

```yaml
filebeat.autodiscover:
     providers:
       - type: kubernetes
         node: ${NODE_NAME}
         hints.enabled: true
         hints.default_config:
           enabled: false 
           type: container
           paths:
             - /var/log/containers/*${data.kubernetes.container.id}.log

```

The dummy nginx pod annotated with `co.elastic.logs/enabled: "true"`:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nginx
  name: nginx
  namespace: default
spec:
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
      annotations:
        co.elastic.logs/enabled: "true"
    spec:
      containers:
      - image: nginx
        name: nginx

```

Only fetches the nginx logs.

Let me know if this works for you

---

<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:** [July 6, 2023, 1:12pm UTC](https://discuss.elastic.co/t/autodiscover-not-working/335522/3 "2023-07-06T13:12:55Z")

</div>

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