Skip to content

Instantly share code, notes, and snippets.

@cutoffthetop
Created December 8, 2013 20:15
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cutoffthetop/7863289 to your computer and use it in GitHub Desktop.
Save cutoffthetop/7863289 to your computer and use it in GitHub Desktop.
Custom Logstash output for HBase
# encoding: utf-8
require 'logstash/outputs/base'
require 'logstash/namespace'
class LogStash::Outputs::HBase < LogStash::Outputs::Base
config_name 'hbase'
milestone 2
# The HBase server uri
config :uri, :validate => :string, :required => false, :default => 'localhost'
# The table name to use
config :table_name, :validate => :string, :required => true
# Optionally define columns
config :columns, :validate => :array, :require => false, :default => ['cf1']
public
def register
require 'rubygems'
require 'hbaserb'
client = HBaseRb::Client.new(@uri)
@logger.debug('Register: established hbase connection')
if client.has_table?(@table_name)
args = [@table_name] + @columns
@table = client.create_table(*args)
else
@table = client.get_table(@table_name)
end
end
public
def receive(event)
document = event.to_hash
@table.mutate_row(document['_id'], {'cf1:col' => document['message']})
end
def teardown
@client.close
@logger.debug('Teardown: closed hbase connection')
end
end
@muthu1086
Copy link

Does the "Exception in thread "LogStash::Runner" org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- hbaserb" error solved??

@ranjitreddy2013
Copy link

is this resolved? I'm seeing same error.

@MaheshSankaran
Copy link

I am also got same error..Is this resolved or not??

@ebuildy
Copy link

ebuildy commented Nov 14, 2015

Hmmm, "no such file to load", not so hard to resolve guys, did you include "https://github.com/bmuller/hbaserb"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment