benthos组件使用系列(output)

output组件的使用记录

file

output:
  file:
    codec: all-bytes
    delimiter: ""
    path: '/home/data/aaa.resource'
  processors:
    - archive:
        format: json_array
    - type: json
    - bloblang:
        root = this

输出前可以定定义输出处理格式。processors
输出目录可以添加参数,实现输出到不同的文件中去。

path: /tmp/data.txt
path: /tmp/${! timestamp_unix() }.txt
path: /tmp/${! json("document.id") }.json

codec:输出的方式,append lines all-bytes delim:x

broker

可以实现文件的多路输出
Allows you to route messages to multiple child outputs using a range of brokering patterns.

output:
  broker:
    pattern: fan_out
    outputs:
      - resource: foo
      - resource: bar
        # Processors only applied to messages sent to bar.
        processors:
          - resource: bar_processor

  # Processors applied to messages sent to all brokered outputs.
  processors:
    - resource: general_processor
    outputs:
      - file:
          codec: lines
          path: '/home/data/fiele001.txt'
      - file:
          codec: lines
          path: '/home/data/fiele001.unl'

待续。。。。

posted @ 2022-02-13 15:47  桂花载酒少年游O  阅读(242)  评论(0编辑  收藏  举报