logback-gelf travis-ci

Logback appender that sends Graylog Extended Log Format (GELF) messages

2 years after

= Logback appender that sends GELF messages

Send log events to a Graylog server by GELF protocol over UDP, TCP, TCP over SSL, or AMQP transport.

== Usage

Add the following dependency to your project:

[source,xml]

com.github.pukkaone logback-gelf 1.1.9

--

Configure a logback appender to send by UDP (XML configuration format):

[source,xml]

graylog.example.com my.machine.example.com true false true false false false gelf-java application=MyApplication environment=development

--

To send by AMQP:

[source,xml]

amqp://amqp.example.com messages gelfudp 5 my.machine.example.com gelf-java application=MyApplication environment=development

--

== Options

graylogHost:: Host name of Graylog server where it will send the GELF messages. Prefix with udp: to send by UDP. Prefix with tcp: to send by TCP. Prefix with ssl: to send by TCP over SSL. If no prefix is present, then the transport is UDP.

graylogPort:: Port on which the Graylog server is listening; default 12201 (optional)

originHost:: Name of the originating host; defaults to the local hostname (optional)

levelIncluded:: Include SLF4J level in the GELF message; default true (optional)

locationIncluded:: Include caller file name and line number. Generating caller location information will severely impact execution speed; default false (optional)

loggerIncluded:: Include SLF4J logger name in the GELF message; default true (optional)

markerIncluded:: Include SLF4J marker name in the GELF message; default false (optional)

mdcIncluded:: Include SLF4J MDC properties in the GELF message; default false (optional)

facility:: Facility value to send in the GELF message; default gelf-java (optional)

additionalField:: Include an additional field with literal value in the GELF message. Give the field name and value in the format key=value. (optional)

amqpURI:: AMQP URI (required when using AMQP integration)

amqpExchange:: AMQP exchange name - should be the same as setup in graylog-radio (required when using AMQP integration)

amqpRoutingKey:: AMQP routing key - should be the same as setup in graylog-radio (required when using AMQP integration)

amqpMaxRetries:: Maximum retries count; default value 0 (optional)

sslTrustAllCertificates:: Skip SSL server certificate validation; default false (optional)

=== Customize GELF messages

If you want to customize the GELF messages sent by the appender, you can replace the class that converts log events to GELF messages with your own implementation. Define a class implementing the GelfMessageFactory interface. Alternatively, you may extend the DefaultGelfMessageFactory class, which implements this interface.

Configure the custom GELF message factory in the appender: [source,xml]

... ReceivedDateTime ...

--

If you just want to customize the short_message and full_message fields of the GELF messages sent by the appender, you can customize the DefaultGelfMessageFactory to apply different patterns.

Configure the default GELF message factory in the appender: [source,xml]

... %.-20m %m%n%xEx ...

--

The default patterns are:

shortMessagePattern:: %m%nopex - log message, excludes stack trace

fullMessagePattern:: %xEx - stack trace

Related Repositories

logstash-gelf

Graylog Extended Log Format (GELF) implementation in Java for all major logging ...

dropwizard-gelf

dropwizard-gelf

Addon bundle for Dropwizard to support logging to a GELF-enabled server like Gra ...

logback-gelf-appender

logback-gelf-appender

Logback appender that sends GELF messages ...

dropwizard-raven

dropwizard-raven

Dropwizard integration for error logging to Sentry. ...

iris

iris

IRIS - Intermodal Routing Information System ...


Top Contributors

t0xa pukkaone joschi h0nIg hackmann rocketraman gdusbabek realityforge stevenschlansker JanGe nstielau andreparodi bjkastel cskinfill fzunino GBT gavares IgorPerikov grafjo nirvdrum lkmikkel lennartkoopmann xlson bouil twinforces radimk ssundell sjoerdmulder thking wujek-srujek

Releases

-   v1.1.4 zip tar
-   v1.1.3 zip tar
-   v1.1.2 zip tar
-   v1.1.1 zip tar
-   v1.1 zip tar
-   v1.0.2 zip tar
-   1.1.10 zip tar
-   1.1.9 zip tar
-   1.1.8 zip tar
-   1.1.7 zip tar
-   1.1.6 zip tar
-   1.1.5 zip tar