【问题标题】:metricbeat output kafka configurationmetricbeat 输出 kafka 配置
【发布时间】:2017-01-13 17:30:59
【问题描述】:

我正在尝试使用 metricbeat 获取系统指标(metricbeat 5.1.1 并将数据输出到 kafka 主题)

output.kafka:
  # Boolean flag to enable or disable the output module.
  enabled: true

  # The list of Kafka broker addresses from where to fetch the cluster metadata.
  # The cluster metadata contain the actual Kafka brokers events are published
  # to.
  hosts: ["XX.XXX.XXX.XX:9092","XX.XXX.XXX.XX:9092","XX.XXX.XXX.XX:9092"]
  # The Kafka topic used for produced events. The setting can be a format string
  # using any event field. To set the topic from document type use `%{[type]}`.
  topic: ab-mb-raw, cd-mb-raw

kafka 中是否可以将数据推送到多个主题?

当我运行上述配置时,我无法看到 kafka topic persistent 中的数据

谁能帮我看看我的配置是否正确?

【问题讨论】:

    标签: elasticsearch apache-kafka metricbeat


    【解决方案1】:

    不直接作为静态字符串,不。但是您可以在那里阅读评论...

    设置可以是使用任何事件字段的格式字符串

    因此,如果您可以在要发送到哪个主题的有效负载中插入一个字段,您就可以通过这种方式动态路由数据

    【讨论】:

      【解决方案2】:

      是的,您可以这样做。基本上你需要在你的探矿者配置中定义。

      例如:

      filebeat.yml

      output.kafka:
        hosts: ["kafka:9092"]
        topic: "%{[type]}"   <----- that is what you need.
        compression: snappy
      
      # Prospector configs
      filebeat.config_dir: /opt/filebeat/etc/conf.d
      

      /opt/filebeat/etc/conf.d 中的探矿者在文件中可能看起来像这样:

      filebeat.prospectors:
        - input_type: log
      paths:
        - "test.log"
      document_type: "topic_name" <--------- topic per prospector
      

      【讨论】:

      • metricbeat 与 filebeat 不同。它没有 document_type 字段!
      猜你喜欢
      • 2019-10-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-13
      • 2021-01-30
      • 2016-09-22
      • 1970-01-01
      相关资源
      最近更新 更多