Skip to content

[Filebeat] Elasticsearch Module w/ Kubernetes Autodiscover Causes Logs in Incorrect Fieldsets #16540

@SpencerLN

Description

@SpencerLN

Issue: Using the Filebeat Elasticsearch module in combination with Kubernetes autodiscover results in logs in the incorrect filesets or duplicate filesets:
image

Expected behavior: Each log message should only appear in the destination a single time, and it should have the appropriate fields associated with the fileset of that log (i.e. server, audit, deprecation, gc, etc.)

  • Version: 7.6.0
  • Operating System: GKE Container Optimized OS
  • Steps to Reproduce:
    Deploying Filebeat using Filebeat Helm chart with values.yaml:
filebeat: 
  # Allows you to add any config files in /usr/share/filebeat
  # such as filebeat.yml
  filebeatConfig:
    filebeat.yml: |-
      filebeat.autodiscover:
       providers:
         - type: kubernetes
           node: ${NODE_NAME}
           hints.enabled: true

      processors:
        - add_cloud_metadata:
        - add_host_metadata:

      output.elasticsearch:
          hosts: 'http://${ELASTICSEARCH_ADDRESS}'
          username: ${ELASTICSEARCH_USERNAME}
          password: ${ELASTICSEARCH_PASSWORD}

  extraEnvs:
    - name: ELASTICSEARCH_USERNAME
      valueFrom: { secretKeyRef: { name: beats-elasticsearch, key: username } }
    - name: ELASTICSEARCH_PASSWORD
      valueFrom: { secretKeyRef: { name: beats-elasticsearch, key: password } }
    - name: ELASTICSEARCH_ADDRESS
      valueFrom: { secretKeyRef: { name: beats-elasticsearch, key: address } }

  imageTag: 7.6.0
  extraVolumeMounts: 
    - name: varlog
      mountPath: /var/log/
      readOnly: true

  extraVolumes: 
    - name: varlog
      hostPath:
        path: /var/log/

In this case Elasticsearch was deployed using ECK, with annotations in the podTemplate to enable the Elasticsearch module:

    podTemplate:
      metadata:
        annotations:
          co.elastic.logs/module: "elasticsearch"

I am attaching the filebeat.log file, the json of the documents from the above screenshot, and the contents of the bulk request that show the documents are being to the corresponding pipelines for each fileset (4 copies of the same document).

The appropriate pipelines were installed in Elasticsearch prior to these logs being ingested:
image

filebeat.log
bulk_request.txt
sample-docs.txt

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions