Feed Your Application Logs to ElasticSearch via logback.xml and Logstash

Nil Seri
May 8, 2021

--

Photo by Nick Karvounis on Unsplash

In your projects, you can feed your logs to ElasticSearch (and also Kibana) with your logback.xml file.

Let’s add logstash dependency to our pom.xml file:

<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>6.3</version>
</dependency>

Update your logback.xml file with the appender named “STASH”:

You can create a Logstash config file like below (pay attention to the destination for your localhost in logback.xml file and the tcp connection host and port below):

Happy Coding!

--

--

Nil Seri
Nil Seri

Written by Nil Seri

I would love to change the world, but they won’t give me the source code | coding 👩🏻‍💻 | coffee ☕️ | jazz 🎷 | anime 🐲 | books 📚 | drawing 🎨

No responses yet