mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -04:00
Merge branch 'master' of https://github.com/pusewicz/logstash into pull/9
This commit is contained in:
commit
5fad88ab96
1 changed files with 19 additions and 7 deletions
|
@ -137,20 +137,32 @@ class LogStash::Web::Server < Sinatra::Base
|
|||
end # class LogStash::Web::Server
|
||||
|
||||
require "optparse"
|
||||
Settings = Struct.new(:daemonize, :logfile)
|
||||
Settings = Struct.new(:daemonize, :logfile, :host, :port)
|
||||
settings = Settings.new
|
||||
|
||||
settings.host = "0.0.0.0"
|
||||
settings.port = 9292
|
||||
|
||||
progname = File.basename($0)
|
||||
|
||||
opts = OptionParser.new do |opts|
|
||||
opts.banner = "Usage: #{progname} [options]"
|
||||
|
||||
opts.on("-d", "--daemonize", "Daemonize (default is run in foreground)") do
|
||||
opts.on("-d", "--daemonize", "Daemonize (default is run in foreground).") do
|
||||
settings.daemonize = true
|
||||
end
|
||||
|
||||
opts.on("-l", "--log FILE", "Log to a given path. Default is stdout.") do |path|
|
||||
settings.logfile = path
|
||||
end
|
||||
|
||||
opts.on("-H", "--host HOST", "Host on which to start webserver. Default is 0.0.0.0.") do |host|
|
||||
settings.host = host
|
||||
end
|
||||
|
||||
opts.on("-p", "--port PORT", "Port on which to start webserver. Default is 9292.") do |port|
|
||||
settings.port = port.to_i
|
||||
end
|
||||
end
|
||||
|
||||
opts.parse!
|
||||
|
@ -178,4 +190,4 @@ Rack::Handler::Thin.run(
|
|||
Rack::CommonLogger.new( \
|
||||
Rack::ShowExceptions.new( \
|
||||
LogStash::Web::Server.new)),
|
||||
:Port => 9292)
|
||||
:Port => settings.port, :Host => settings.host)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue