Merge remote-tracking branch 'logstash/master'

This commit is contained in:
Bob Corsaro 2011-06-01 13:13:34 -04:00
commit 5f0f75ccd7
6 changed files with 31 additions and 7 deletions

View file

@ -13,3 +13,4 @@ Contributors:
* John Vincent (lusis)
* Bob Corsaro (dokipen)
* kjoconnor
* Evgeny Zislis (kesor)

View file

@ -4,7 +4,7 @@ gem "bunny" # for amqp support, MIT-style license
gem "uuidtools" # for naming amqp queues, License ???
gem "filewatch", "~> 0.2.3" # for file tailing, BSD License
gem "jls-grok", "~> 0.4.7" # for grok filter, BSD License
gem "jruby-elasticsearch", "~> 0.0.7" # BSD License
gem "jruby-elasticsearch", "~> 0.0.8" # BSD License
gem "stomp" # for stomp protocol, Apache 2.0 License
gem "json" # Ruby license
gem "awesome_print" # MIT License

View file

@ -33,6 +33,9 @@ class LogStash::Outputs::Elasticsearch < LogStash::Outputs::Base
# REST API port (normally 9200).
config :port, :validate => :number, :default => 9300
# The name/address of the host to bind to for ElasticSearch clustering
config :bind_host, :validate => :string
# TODO(sissel): Config for river?
public
@ -53,7 +56,8 @@ class LogStash::Outputs::Elasticsearch < LogStash::Outputs::Base
@pending = []
@callback = self.method(:receive_native)
@client = ElasticSearch::Client.new(:cluster => @cluster,
:host => @host, :port => @port)
:host => @host, :port => @port,
:bind_host => @bind_host)
end # def register
# TODO(sissel): Needs migration to jrubyland

View file

@ -14,6 +14,9 @@ class LogStash::Outputs::Mongodb < LogStash::Outputs::Base
# The database to use
config :database, :validate => :string, :required => true
config :user, :validate => :string, :required => false
config :password, :validate => :password, :required => false
# The collection to use. This value can use %{foo} values to dynamically
# select a collection based on data in the event.
config :collection, :validate => :string, :required => true
@ -21,9 +24,16 @@ class LogStash::Outputs::Mongodb < LogStash::Outputs::Base
public
def register
require "mongo"
# TODO(petef): support authentication
# TODO(petef): check for errors
@mongodb = Mongo::Connection.new(@host, @port).db(@database)
db = Mongo::Connection.new(@host, @port).db(@database)
auth = true
if @user then
auth = db.authenticate(@user, @password.value) if @user
end
if not auth then
raise RuntimeError, "MongoDB authentication failure"
end
@mongodb = db
end # def register
public

View file

@ -15,8 +15,11 @@ class LogStash::Search::ElasticSearch < LogStash::Search::Base
@host = (settings[:host] || nil)
@port = (settings[:port] || 9300).to_i
@cluster = (settings[:cluster] || nil)
@bind_host = (settings[:bind_host] || nil)
@logger = LogStash::Logger.new(STDOUT)
@client = ElasticSearch::Client.new(:host => @host, :port => @port, :cluster => @cluster)
@client = ElasticSearch::Client.new(:host => @host, :port => @port,
:cluster => @cluster,
:bind_host => @bind_host)
end
# See LogStash::Search;:Base#search

View file

@ -64,7 +64,9 @@ class LogStash::Web::Server < Sinatra::Base
@backend = LogStash::Search::ElasticSearch.new(
:host => backend_url.host,
:port => backend_url.port,
:cluster => cluster_name
:cluster => cluster_name,
:bind_host => settings.bind_host
)
when "twitter"
require "logstash/search/twitter"
@ -91,7 +93,7 @@ class LogStash::Web::Server < Sinatra::Base
end # class LogStash::Web::Server
require "optparse"
Settings = Struct.new(:daemonize, :logfile, :address, :port, :backend_url)
Settings = Struct.new(:daemonize, :logfile, :address, :port, :backend_url, :bind_host)
settings = Settings.new
settings.address = "0.0.0.0"
@ -119,6 +121,10 @@ opts = OptionParser.new do |opts|
settings.port = port.to_i
end
opts.on("-B", "--elasticsearch-bind-host ADDRESS", "Address on which to bind elastic search node.") do |addr|
settings.bind_host = addr
end
opts.on("-b", "--backend URL",
"The backend URL to use. Default is elasticserach:/// (assumes " \
"multicast discovery); You can specify " \