franzhcs / fluentd4log4j   1.0


Fluentd Log4j Appender

Scala versions: 2.11


Release Artifacts

A Log4J appender to push log events to a fluentd server.

How to Use

At the beginning it could be surprising that this project is packaged via SBT (being the codebase mostly in Java). Main reason is that I am not familiar at all with Maven/POMs. This SBT project comes with the sbt assembly plugin configured.

The scala version used is 2.11 as this is compatible with Spark.

Maven dependency


SBT dependency

libraryDependencies += "io.github.elbryan" % "fluentd4log4j" % "1.0"


property default value Description
mdcKeys "" The MDC keys (comma separated) that should be added to the log structure.
tagPrefix "" The fluentd tag prefix to be used
tag "log" The fluentd tag to be used in all the log messages sent there
host "localhost" The fluentd server host to where to send the log messages.
port 24224 The fluentd server port to where to send the log messages.
timeout 15000 (15s) The timeout (in milliseconds) to connect to the fluentd server
bufferCapacity 1048576 (1Mb) The socket buffer capacity to connect to the fluentd server
useConstantDelayReconnector false Switch from the default Exponential Delay reconnector to a constant delay reconnector


log4j.rootLogger=info, fluentd

fluentd configuration

  type forward
  port 24224

<match ** >
	type stdout

Assembling the project / fatjars

If you want to generate the fatjar, simply open sbt and issue assembly

$> sbt
sbt:fluentd4log4j> assembly


This is available in the Apache Licence 2.0