Sha256: aacac09134501d8c997b4166b49acd7d4ebd7b4d544c34de12ab87af0bbab8bb
Contents?: true
Size: 1.26 KB
Versions: 13
Compression:
Stored size: 1.26 KB
Contents
#!/usr/bin/env ruby $: << File.dirname($0) + "/../lib" require "rubygems" require "eventmachine" require "logstash/agent" require "optparse" require "yaml" Settings = Struct.new(:config_file, :daemonize) settings = Settings.new settings.daemonize = false settings.config_file = nil progname = File.basename($0) opts = OptionParser.new do |opts| opts.banner = "Usage: #{progname} [options]" opts.on("-f CONFIGFILE", "--config CONFIGFILE", "Load the logstash config from a specific file") do |arg| settings.config_file = arg end #opts.on("-d", "--daemonize", "Daemonize (default is run in foreground)") do #settings.daemonize = true #end end begin opts.parse! if settings.config_file == "" or settings.config_file == nil raise "No config file given. (missing -f or --config flag?)" end rescue $stderr.puts "#{progname}: #{$!}" $stderr.puts opts exit(1) end # TODO(sissel): put the config management stuff in LogStash::Agent if !File.exist?(settings.config_file) $stderr.puts "Config file '#{settings.config_file}' does not exist." end begin config = YAML::load_file(settings.config_file) rescue => e $stderr.puts "Loading config file '#{settings.config_file}' failed: #{e}" exit 1 end agent = LogStash::Agent.new(config) agent.run
Version data entries
13 entries across 13 versions & 1 rubygems