是否有一种方法来写基于电报输入kafka主题?



我想根据输入插件将agent收集的数据在kafka中写入不同的主题。我们是否可以将采集到的数据根据telegraph的输入分别转发给kafka topic ?

这是我的电报。conf文件

[global_tags]

[agent]
interval = "20s"
round_interval = true
metric_batch_size = 10000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = "0s"
hostname = ""
omit_hostname = false

[[outputs.kafka]]
brokers = ["127.0.0.1:9092","127.0.0.1:9093"]
#topic = "telegraf"
client_id = "abc-def-ghj-klm"
max_retry = 3
## Optional TLS Config
sasl_username = "test"
sasl_password = "test123"
sasl_mechanism = "PLAIN"
insecure_skip_verify = false
data_format = "json"

[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
[[inputs.system]]
[[inputs.internal]]

有一个简单的方法,只需添加"kafka.topic_suffix"Conf到您的输出。卡夫卡的设置。之后,你可以看到你的新主题是自动创建的电报类似的这些;Telegraf_cpu, telegraf_system, telegraf_blabla.

[[outputs.kafka]]
brokers = ["127.0.0.1:9092","127.0.0.1:9093"]
topic = "telegraf"
client_id = "abc-def-ghj-klm"
max_retry = 3
## Optional TLS Config
sasl_username = "test"
sasl_password = "test123"
sasl_mechanism = "PLAIN"
insecure_skip_verify = false
data_format = "json"
[outputs.kafka.topic_suffix]
method = "measurement"
separator = "_"

相关内容

  • 没有找到相关文章

最新更新