Home

Awesome

rabbitmq.log4net.gelf.appender

Logo

The RabbitMQ GELF appender is a customer appender for the log4net logging framework which publishes log messages onto RabbitMQ message bus using the GELF (json) format.

USAGE

download the nuget package from the repository

https://nuget.org/packages/rabbitmq.log4net.gelf.appender/

change your app/web config file

sample config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net" />
  </configSections>
  
  <log4net>
    <appender name="rabbitmq.gelf.appender" type="rabbitmq.log4net.gelf.appender.GelfRabbitMqAppender, rabbitmq.log4net.gelf.appender">
      <HostName value="localhost" />
      <VirtualHost value="/" />
      <Port value="5672" />
      <Exchange value="log4net.gelf.appender" />
      <Username value="guest" />
      <Password value="guest" />
      <Facility value="sample-application" />
    </appender>

   
    <root>
      <level value="ERROR" />
      <appender-ref ref="rabbitmq.gelf.appender" />
    </root>
  </log4net>

</configuration>

Gelf Format

https://github.com/Graylog2/graylog2-docs/wiki/GELF

Use case

Sending your log messages onto a message bus (RabbitMQ) means they can be picked up easily and processed by a variety of consumers.

In particular it's handy with a log aggregator like LogStash. Just configure the RabbitMQ input and use Kibana to search the ElasticSearch database of your logs.

CHANGE LOG

Version 0.2

Version 0.1.7

Version 0.1.6

Version 0.1.5