My FeedDiscussionsHashnode Enterprise
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Streaming Spring Boot Logs to Apache Kafka

Dhiraj Ray's photo
Dhiraj Ray
·Apr 11, 2018

1_PQgn_cxo9sohjEf5Kwm6Tg.png In this tutorial series, we will be discussing about how to stream log4j application logs to apache Kafka using maven artifact kafka-log4j-appender.To keep application logging configuration simple, we will be doing spring boot configurations and stream log4j logs to apache Kafka. We have already installed and configured apache Kafka in our local system in my last article - Apache Kafka With java and Maven . Hence, we will skip that part and directly create a spring boot application.This application will have log4j configuration with simple Kafka Appender that will stream the logs generated in the application to kafka running on port 9092. And to make this tutorial simple, we will have a java consumer class that will be consuming the messages from Kafka topic and print in the console.

In the next article, we will configure logstash to consume these messages from the Kafka topic and push to elasticsearch.

Continue Reading...