k8s filebeat 接入kafka

k8s filebeat 接入kafka_第1张图片

 这里是吧容器的本地日志目录挂载filebeat,然后filebeat 读取日志写入到kafka

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: filebeat-config
  namespace: kube-system
  labels:
    k8s-app: filebeat
data:
  filebeat.yml: |-
    filebeat.inputs:
      - type: log
        paths:
          - /var/lib/docker/containers/*/*.log
        exclude_lines: ["^DBG"]
        exclude_files: [".gz$"]
        document_type: "docker2"
    output.kafka:
      hosts: ["10.1.234.123:9092","10.1.234.124:9092","10.1.234.125:9092"]
      topic: "docker2"
      partition.round_robin:
        reachable_only: true
      worker: 2
      required_acks: 1
      compression: gzip
      max_message_bytes: 10000000

你可能感兴趣的:(k8s篇)