Pyspark Streaming - 如何设置自定义日志记录?

act*_*ner 6 logging apache-spark spark-streaming logstash-forwarder pyspark

我有一个在Hadoop集群中运行的pyspark流应用程序.流应用程序每n秒从Kafka队列中读取一次并进行REST调用.

我有一个日志记录服务,提供一种简单的方法来收集和存储数据,将数据发送到Logstash并在Kibana中可视化数据.数据需要符合此服务提供的模板(具有特定密钥的JSON).

我想使用此服务将流媒体应用程序中的日志发送到Logstash.为此,我需要做两件事:

- Collect some data while the streaming app is reading from Kafka and making the REST call. 
- Format it according to the logging service template.
- Forward the log to logstash host.
Run Code Online (Sandbox Code Playgroud)

任何与此相关的指导都会非常有帮助.

谢谢!