如何从kafka中的文件读取日志? [英] How to read logs from file in kafka?
本文介绍了如何从kafka中的文件读取日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在 kafka 中读取 Apache 日志,然后进一步处理到 Spark Streaming.我是 kafka 的新手.据我所知,我必须编写一个生产者类来读取日志文件.
I want to read Apache logs in kafka and then further process in to Spark Streaming.I am new to kafka. As far as I have understand I have to write a producer class to read logs file.
推荐答案
您可以通过创建一个连接器来实现此目的,该连接器将日志文件的每一行都导入到 Kafka 主题中.在此处查看示例:
You can do so by creating a connector which sources each line of the log file into the Kafka topic. Check out the example here:
https://docs.confluent.io/current/connect/devguide.html#connect-developing-simple-connector
这篇关于如何从kafka中的文件读取日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文