Skip to content

logstash-logback-encoder-5.0

Choose a tag to compare

Overview

Version 5.0 is a major release with several new features and bugfixes.

Several backwards incompatibilities were introduced (see section below). Most have the ability to revert to previous behavior via config changes if necessary.

Support for Java 1.6 has been removed. Java 1.7 or above is now required.

New Features

  • Added Appender Listeners so that applications can receive notifications for the appender lifecycle and event processing. In the future, listeners can be added to implement metrics (#126 ) or customized error handling/reporting (#159, #127). Applications can also provide their own listeners.
  • #194 Added Header Filters for deciding which request/response headers to include in access events
  • #251 Added a #tryJson pattern operation to fall back to just printing the message if the argument is not valid JSON
  • #258 Added a timestampPattern configuration property to LogstashEncoder, LogstashLayout, LogstashAccessEncoder, and LogstashAccessLayout
  • Added CompositeJsonFactoryDecorator and CompositeJsonGeneratorDecorator to make it easier to add multiple decorators.
  • #257 @jackhammer2k Added new throwableClassName and throwableRootCauseClassName JSON providers

Bug fixes / Minor improvements

  • #241 Fixed the pattern JsonProvider to be able to be used within the nestedField JsonProvider
  • #237 Fixed setting the buffer initial capacity of the ShortenedThrowableConverter
  • #243 Documented using dependencyManagment to sync logback dependency versions
  • #259 Upgraded jackson dependencies to 2.9.4 as mentioned in dependency version changes below (@haus contributed to this update)
  • com.fasterxml.uuid:java-uuid-generator is no longer included in the logstash-logback-encoder jar, and is now an optional dependency
  • #240 @robsonbittencourt Fixed anchors in README.md

Dependency version changes

Usage Dependency Old Version New Version
Runtime jackson 2.8.9 2.9.4
Runtime (shaded) disruptor 3.3.4 3.3.8
Compile-time animal-sniffer 1.15 1.16
Test-time assertj 2.4.0 2.9.0
Test-time mockito 1.10.19 2.9.0
Test-time powermock 1.6.5 1.7.3
Test-time commons-io 2.4 2.6

Backwards Incompatibilities

  • Support for Java 1.6 has been removed. Java 1.7 or above is now required.

  • For #112, the default maxDepthPerThrowable of the ShortenedThrowableConverter has been changed to be full/unlimited to be be better aligned with its other configuration parameters.

    To revert to the old value, specify 25 for the maxDepthPerThrowable as documented here

  • For #138 and #150, access event field names have been changed.

    Old field name New field name
    @fields.content_length content_length
    @fields.elapsed_time elapsed_time
    @fields.method method
    @fields.protocol protocol
    @fields.requested_url requested_url
    @fields.requested_uri requested_uri
    @fields.remote_host remote_host
    @fields.remote_user remote_user
    @fields.status_code status_code
    @fields.HOSTNAME n/a
    @message message

    To revert to the old field names, specify the following in the encoder/layout configuration:

    <fieldNames class="net.logstash.logback.fieldnames.Pre50LogstashAccessFieldNames"/>
  • For #176, the @fields.hostname field has been removed. It's value was always the same as the @fields.remoteHost field value (which is now the remoteHost field)

  • For #169, the arguments JSON provider has been enabled by default in the LogstashEncoder, LogstashLayout, LogstashAccessEncoder, and LogstashAccessLayout

    To disable the arguments provider, specify the following in the encoder/layout configuration:

    <includeStructuredArguments>false</includeStructuredArguments>
  • For #174, the default field type of the @version field has changed from an integer to a string.

    To change the @version field type back to an integer, specify the following in the encoder/layout configuration:

    <writeVersionAsInteger>true</writeVersionAsInteger>

    or, if you are using the version provider directly, specify the following in the version provider configuration:

    <writeAsInteger>true</writeAsInteger>
  • For #261 ESCAPE_NON_ASCII is now disabled by default

    To reenable it, you can use the EscapeNonAsciiJsonFactoryDecorator by specifying the following in the encoder/layout configuration:

    <jsonFactoryDecorator class="net.logstash.logback.decorate.EscapeNonAsciiJsonFactoryDecorator"/>

    If you were already using a jsonFactoryDecorator, you can use the new CompositeJsonFactoryDecorator to add multiple JsonFactoryDecorators

  • Request/response header names are now written in lowercase by default

    To revert to the original behavior, specify the following in the encoder/layout/provider configuration:

    <lowerCaseHeaderNames>false</lowerCaseHeaderNames>