Apache kafka filebeat中的kafka记录密钥提取

Apache kafka filebeat中的kafka记录密钥提取,apache-kafka,filebeat,Apache Kafka,Filebeat,据此: 但是,它没有具体说明如何做 我的文件中有一个事件(json消息),需要使用filebeat发送给卡夫卡 "message": { "name": "display", "id": "asdf-123", "type": "User", ... } 我试过像这样使用filebeat.yml: filebeat.prospectors: - input_type: log paths: - ... output.kafka:

据此:

但是,它没有具体说明如何做

我的文件中有一个事件(json消息),需要使用filebeat发送给卡夫卡

 "message":
 {
    "name": "display",
    "id": "asdf-123",
    "type": "User",
    ...
 }
我试过像这样使用filebeat.yml:

filebeat.prospectors:
  - input_type: log
    paths:
      - ...
output.kafka:
  codec.format:
    string: '%{[message]}'
  hosts: ["localhost:9091"]
  key: '%{[event.id]}'
  topic: 'my-topic'
  ...
这里我试图从json中提取
message.id
,用作卡夫卡记录键。 这行不通


我的问题是,我们如何格式化filebeat中的消息以包含动态键。

在这里找到了一个非常匹配的对话:这表示我们可以提取json字段。。但似乎不起作用。那么嵌套的json字段呢?我认为您必须添加logstash来提取嵌套字段。否则,
event.message.id
在这里找到了一个非常匹配的对话:这表示我们可以提取json字段。。但似乎不起作用。那么嵌套的json字段呢?我认为您必须添加logstash来提取嵌套字段。否则,
event.message.id
filebeat.prospectors:
  - input_type: log
    paths:
      - ...
output.kafka:
  codec.format:
    string: '%{[message]}'
  hosts: ["localhost:9091"]
  key: '%{[event.id]}'
  topic: 'my-topic'
  ...