Skip to content

Additional adapters gelf

rudionrails edited this page Apr 3, 2012 · 4 revisions

Graylog2 (GELF) Adapter

The GELF adapter for Yell is available as separate gem.

Installation

System wide:

gem install yell-adapters-gelf

Or in your Gemfile:

gem "yell-adapters-gelf"

Since the yell is a gem dependency, it will be installed automatically with it.

Usage

After you set-up Graylog2 accordingly, you may use the Gelf adapter just like any other.

logger = Yell.new :gelf

logger.info "Hello World"
# Check your Graylog2 web server for the received message.

Or alternatively with the block syntax:

logger = Yell.new do |l|
  l.adapter :gelf
end

logger.info 'Hello World!'

If you are running Graylog2 on a different server or port, you can pass those options to the adapter:

logger = Yell.new :gelf, :host => 'hostname', :port => 1234

# Or with the block syntax
logger = Yell.new do |l|
  l.adapter :gelf, :host => 'hostname', :port => 1234
end

logger.info 'Hello World!'