Autodiscover not working

Greetiings,

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

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

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

in both scenario pod annotation present.

Hello,

This is the config that works for me for 8.8.0:

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":

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

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