gjsduarte / logback-datadog-appender   0.1.2

Apache License 2.0 GitHub

This appender sends logs to your Datadog account, in bulks using non-blocking threading

Scala versions: 2.11

Datadog logback appender

CircleCI Codacy Badge Maven Central

This appender sends logs to your Datadog account, in bulks using non-blocking threading. Please note that this appender requires logback version 1.2.3 and up, and java 8 and up.

Technical Information

This appender uses the SocketAppender implementation. All logs are placed in a in-memory buffer before being sent. Once you send a log, it will be enqueued in the buffer and 100% non-blocking. There is a background task that will handle the log shipment for you.

Logback Example Configuration

<!-- Use debug=true here if you want to see output from the appender itself -->
<!-- Use line=true here if you want to see the line of code that generated this log -->
<configuration>
    <!-- Use shutdownHook so that we can close gracefully and finish the log drain -->
    <shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>
    <appender name="Datadog" class="com.gjsduarte.DatadogAppender">
        <apiKey>yourdatadogapitoken</apiKey>
        <service>my awesome application</service>
    </appender>
</configuration>

Parameters

Parameter Default Explained
apiKey None Your Datadog api key, which can be found under "integrations" in your account
aws false
block 5 Timeout (in seconds) to block the shutdown waiting for logs to be sent
environment None Name of the application environment
port 10514
remoteHost intake.logs.datadoghq.com
service None
source logback
sourceCategory sourcecode

Contribution

  • Fork
  • Code
  • sbt compile
  • Issue a PR :)