Skip to content

Instantly share code, notes, and snippets.

@curzonj
Created October 26, 2011 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save curzonj/1315957 to your computer and use it in GitHub Desktop.
Save curzonj/1315957 to your computer and use it in GitHub Desktop.
Skeleton of a logstash router
#!/usr/bin/env jruby
require 'rubygems'
require 'logstash'
include Logstash
router = Router.new(ARGV) do
router.inputs(:queue => "queue1").add(
Inputs::Gelfd,
:config => values)
router.inputs(:queue => "queue2").add(
Inputs::Redis,
:config => values)
grok = Grok.new do
match "field" => "pattern"
end
router.receive('queue1') do |msg, ctl|
if grok.match?(msg)
ctl.forward "redis://localhost"
end
end
router.receive('queue2') do |msg, ctl|
if grok.match?(msg)
ctl.forward "statsd://localhost"
end
end
router.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment