Skip to content

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

License

Notifications You must be signed in to change notification settings

derrickchilders/logback-gelf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logback appender that sends GELF messages

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

Usage

Add the following dependency to your project:

<dependency>
  <groupId>com.github.pukkaone</groupId>
  <artifactId>logback-gelf</artifactId>
  <version>1.1.6</version>
</dependency>

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

<appender name="GRAYLOG2" class="com.github.pukkaone.gelf.logback.GelfAppender">
  <graylogHost>graylog2.example.com</graylogHost>
  <originHost>my.machine.example.com</originHost>
  <levelIncluded>true</levelIncluded>
  <locationIncluded>false</locationIncluded>
  <loggerIncluded>true</loggerIncluded>
  <markerIncluded>false</markerIncluded>
  <mdcIncluded>false</mdcIncluded>
  <threadIncluded>false</threadIncluded>
  <additionalField>application=MyApplication</additionalField>
  <additionalField>environment=development</additionalField>
  <numericField>ResponseTimeMs</numericField>
</appender>

To send by AMQP:

<appender name="GRAYLOG2" class="com.github.pukkaone.gelf.logback.GelfAppender">
  <amqpURI>amqp://amqp.example.com</amqpURI>
  <amqpExchange>messages</amqpExchange>
  <amqpRoutingKey>gelfudp</amqpRoutingKey>
  <amqpMaxRetries>5</amqpMaxRetries>
  <originHost>my.machine.example.com</originHost>
  <additionalField>application=MyApplication</additionalField>
  <additionalField>environment=development</additionalField>
</appender>

Options

graylogHost

Host name of Graylog2 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 Graylog2 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)

additionalField

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

numericField

Convert field names to a numeric type.

amqpURI

AMQP URI (required when using AMQP integration)

amqpExchange

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

amqpRoutingKey

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

amqpMaxRetries

Maximum retries count; default value 0 (optional)

sslTrustAllCertificates

Skip SSL server certificate validation; default false (optional)

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%