【问题标题】:How to configure Filebeat on ECK for kafka input?如何在 ECK 上为 kafka 输入配置 Filebeat?
【发布时间】:2021-02-04 10:32:22
【问题描述】:

我在 Kubernetes 上运行 Elasticsearch 和 Kibana。两者均由 ECK 创建。现在我尝试将 Filebeat 添加到其中并将其配置为索引来自 Kafka 主题的数据。这是我目前的配置:

apiVersion: beat.k8s.elastic.co/v1beta1
kind: Beat
metadata:
   name: my-filebeat
   namespace: my-namespace
spec:
   type: filebeat
   version: 7.10.2
   elasticsearchRef:
       name: my-elastic
   kibanaRef:
       name: my-kibana
   config:
       filebeat.inputs:
       - type: kafka
         hosts:
         - host1:9092
         - host2:9092
         - host3:9092
         topics: ["my.topic"]
         group_id: "my_group_id"
         index: "my_index"
   deployment:
       podTemplate:
           spec:
               dnsPolicy: ClusterFirstWithHostNet
               hostNetwork: true
               securityContext:
                   runAsUser: 0
               containers:
               - name: filebeat

在 pod 的日志中,我可以看到如下条目

log/log.go:145  Non-zero metrics in the last 30s    {"monitoring": {"metrics": {"beat":{"cpu":{"system":{"ticks":2470,"time":{"ms":192}},"total":{"ticks":7760,"time":{"ms":367},"value":7760},"user":{"ticks":5290,"time":{"ms":175}}},"handles":{"limit":{"hard":1048576,"soft":1048576},"open":13},"info":{"ephemeral_id":"5ce8521c-f237-4994-a02e-dd11dfd31b09","uptime":{"ms":181997}},"memstats":{"gc_next":23678528,"memory_alloc":15320760,"memory_total":459895768},"runtime":{"goroutines":106}},"filebeat":{"harvester":{"open_files":0,"running":0},"inputs":{"kafka":{"bytes_read":46510,"bytes_write":37226}}},"libbeat":{"config":{"module":{"running":0}},"pipeline":{"clients":1,"events":{"active":0}}},"registrar":{"states":{"current":0}},"system":{"load":{"1":1.18,"15":0.77,"5":0.97,"norm":{"1":0.0738,"15":0.0481,"5":0.0606}}}}}}

也没有错误条目。所以我假设与 Kafka 的连接有效。不幸的是,上面指定的 my_index 中没有数据。我做错了什么?

【问题讨论】:

    标签: elasticsearch kubernetes elastic-stack filebeat


    【解决方案1】:

    我猜你无法连接到输出中提到的 Elasticsearch。

    根据文档,ECK 保护部署的 Elasticsearch 并将其存储在 Kubernetes Secrets 中。

    https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-beat-configuration.html

    【讨论】:

    • 我可以验证连接是否有效,因为我已经尝试了另一个输入(如 QuickStart 示例中的容器)并且可以在 Elasticsearch 中看到索引文档。您指向的示例是用于监控 Elasticsearch 本身,您需要额外的权限。但我不需要它,我只想将文档索引到现有索引中。
    • 如果配置中提到的consumer group已经创建,可以查看Filebeat是否从Kafka topic中读取。您可以通过运行列出所有创建的消费者组: kafka-consumer-groups --bootstrap-server --list
    猜你喜欢
    • 2019-06-28
    • 2022-11-09
    • 2018-05-13
    • 1970-01-01
    • 2022-01-17
    • 2020-03-25
    • 1970-01-01
    • 2018-12-20
    • 2017-03-13
    相关资源
    最近更新 更多