• Stars
    star
    153
  • Rank 238,398 (Top 5 %)
  • Language
    Ruby
  • License
    MIT License
  • Created almost 14 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Ruby GELF library (Graylog Extended Log Format)

GELF Ruby library

This is the new GELF gem written by Alexey Palazhchenko. It is based on the old gem by Lennart Koopmann and allows you to send GELF messages to Graylog or Logstash instances. See the GELF specification for more information about GELF and RDoc for API documentation.

Tested with Ruby 1.9, 2.0, 2.1, 2.2, 2.3 and 2.4.

Build Status Code Climate

Usage

Gelf::Notifier

This allows you to send arbitary messages via UDP to Graylog.

n = GELF::Notifier.new("localhost", 12201)

# Send with custom attributes and an additional parameter "foo"
n.notify!(:short_message => "foo", :full_message => "something here\n\nbacktrace?!", :_foo => "bar")

# Pass any object that responds to .to_hash
n.notify!(Exception.new)

The recommended default is to send via UDP but you can choose to send via TCP like this:

n = GELF::Notifier.new("127.0.0.1", 12201, "LAN", { :protocol => GELF::Protocol::TCP })

Note that the LAN or WAN option is ignored for TCP because no chunking happens. (Read below for more information.)

Gelf::Logger

The Gelf::Logger is compatible with the standard Ruby Logger interface and can be used interchangeably. Under the hood it uses Gelf::Notifier to send log messages via UDP to Graylog.

logger = GELF::Logger.new("localhost", 12201, "WAN", { :facility => "appname" })

logger.debug "foobar"
logger.info "foobar"
logger.warn "foobar"
logger.error "foobar"
logger.fatal "foobar"

logger << "foobar"

Then WAN or LAN option influences the UDP chunk size depending on if you send in your own network (LAN) or on a longer route (i.e. through the internet) and should be set accordingly.

Since it's compatible with the Logger interface, you can also use it in your Rails application:

# config/environments/production.rb
config.logger = GELF::Logger.new("localhost", 12201, "WAN", { :facility => "appname" })

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright (c) 2010-2016 Lennart Koopmann and Alexey Palazhchenko. See LICENSE for details.

More Repositories

1

graylog2-web-interface

[DEPRECATED]
612
star
2

cli-dashboard

A Graylog stream dashboard that runs in your shell.
JavaScript
215
star
3

graylog-plugin-slack

Graylog alarm callback for Slack
Java
113
star
4

graylog-plugin-metrics-reporter

Graylog Metrics Reporter Plugins
Java
77
star
5

graylog-contentpack-nginx

A nginx content pack for Graylog
75
star
6

graylog-plugin-spaceweather

Ever needed a proof that a solar storm made a bit flip and your code crash? Now you can! Correlate proton density to the response time of your app and the ion temperature to your exception rate.
Java
66
star
7

gelf-php

[DEPRECATED] PHP classes to send GELFmessages
PHP
62
star
8

graylog2-stream-dashboard

[DEPRECATED] Get a dashboard optimized view on your Graylog2 streams.
ApacheConf
56
star
9

log4j2-gelf

GELF Appender for Apache Log4j 2
Java
52
star
10

collector

[DEPRECATED] The Graylog Collector
Java
40
star
11

apache-mod_log_gelf

Apache2 module for writing access logs to Graylog
C
31
star
12

syslog4j-graylog2

The syslog4j fork from Graylog2. This is used since 0.10.0. The original code was very "special" and no actions were taken to improve it. This is planned to be replaced completely in future versions.
Java
31
star
13

graylog-plugin-snmp

Graylog plugin to receive SNMP traps
Java
26
star
14

shadowCA

Create a CA and Certificates to use in your Infrastructure
Shell
21
star
15

graylog-plugin-metrics

Graylog output plugin for Graphite and Ganglia
Java
18
star
16

graylog-plugin-mongodb-profiler

Graylog input plugin that reads MongoDB profiler data
Java
17
star
17

graylog-plugin-redis

Redis plugin for Graylog
Java
14
star
18

jersey-netty

[DEPRECATED] Netty 3 container for Jersey 2
Java
14
star
19

check-graylog2-stream

Icinga/Nagios check to monitor Graylog2 stream alerts
Go
14
star
20

graylog-plugin-mqtt

MQTT Input Plugin for Graylog
Java
13
star
21

graylog-plugin-internal-logs

Graylog plugin to record internal logs of Graylog efficiently instead of sending them over the network
Java
12
star
22

graylog-plugin-pagerduty

A Graylog plugin that triggers PagerDuty events
Java
11
star
23

graylog-plugin-splunk

Graylog output plugin that forwards one or more streams of data to Splunk via TCP.
Java
11
star
24

play2-graylog2

[DEPRECATED] How to send logs from the Play! framework to Graylog
Java
11
star
25

graylog2-puppet

[DEPRECATED] Puppet module to install and manage a Graylog 1.x system.
Puppet
10
star
26

graylog-plugin-dnsresolver

Message filter plugin to reverse lookup the source field
Java
9
star
27

graylog-plugin-hipchat

Alarm callback that is writing to HipChat chatrooms
Java
9
star
28

jest-elasticsearch-rest

[WIP] Elasticsearch low-level REST client adapter for Jest
Java
8
star
29

graylog-contentpack-cisco-catalyst

Graylog content pack for Cisco Catalyst devices
8
star
30

graylog-plugin-twitter

Graylog input plugin that reads Twitter messages based on keywords in realtime
Java
8
star
31

graylog-plugin-riemann

Graylog2 output plugin to send events to a Riemann instance
Java
7
star
32

graylog-vscode-extension

TypeScript
5
star
33

graylog-contentpack-heroku

Graylog content pack for Heroku logs
5
star
34

graylog-example-plugin-function-strlen

Example plugin: Pipeline function that returns the length of a string.
Java
4
star
35

graylog-contentpack-haproxy

Graylog content pack to parse the standard HAProxy HTTP logs.
4
star
36

metrics-gelf

A GELF reporter for the Dropwizard Metrics library
Java
4
star
37

apollo

The Graylog support data collector
Go
3
star
38

graylog-playground

Shell
3
star
39

graylog-plugin-rundeck

Graylog alarm callback plugin for Rundeck
Java
3
star
40

graylog-plugin-nats

NATS plugin for Graylog
Java
3
star
41

graylog-contentpack-rails

Content pack for this official guide: https://marketplace.graylog.org/addons/2a5a0954-96f7-4c86-895b-a44e358a9571
2
star
42

regex-library-shootout

Simple comparison benchmarks for various regex-based operations
Java
2
star
43

graylog-plugin-twiliosms

Transport that sends alarms via the Twilio SMS API
Java
2
star
44

graylog-plugin-jabber

Jabber Alarmcallback Plugin for Graylog
Java
2
star
45

graylog-plugin-filter-messagesize

A filter plugin that identifies messages with an estimated size over a certain threshold.
Java
1
star
46

graylog-plugin-zeromq

ZeroMQ integration for Graylog
Java
1
star
47

svloggelfd

Sends service log messages as UDP/GELF to a Graylog server
Go
1
star
48

java-compression-benchmarks

Java
1
star
49

graylog-mpproxy-messina

Bunyan (node.js) GELF support
1
star
50

graylog-web-plugin

[DEPRECATED] Containing helpers to streamline web interface plugin development
JavaScript
1
star
51

graylog-plugin-archetype

[DEPRECATED] Maven archetype to write Graylog2 plugins
Java
1
star
52

graylog-plugin-ipanonymizer

A graylog-server plugin that replaces the last octet of IP addresses in messages with xxx
Java
1
star
53

udpcat

CLI utility to send text files to a remote host via UDP, one packet per line
Makefile
1
star
54

eaio-uuid

Fork of eaio-uuid that works with Java 9+
Java
1
star