How To Forward Logs to Grafana Loki using Logbackappender

Hi All,

I have installed the LOKI and the server is up and running. Also I have configured with Grafana.

I have test application which is developed in Java with log4j. I like to Forward the log details of my test application to Grafana LOKI with help of logback appender.

I have updated my POM.XML with loki dependency and created the logback.xml file and placed in the folder.
I am not sure where to configure to send the logfile from logback to Loki. Can some one help me on this


you said that your application is developed with log4j, then you are talking about Logback. You can send logs to Loki using any of those so either way is fine.

What do you mean by “loki dependency” that you added to pom?

Typically you will need a dependency on a logging framework (log4j2 or Logback) and dependency on some custom appender made specially for sending logs to Loki.

To my knowledge there are two projects that can help you.

I myself have developed Tjahzi which provides a log4j2 appender as well as logback appender.
There is also Loki4j project which seems to provide a fine logback appender.

Both have extensive documentation.