Sha256: cffb488a18cccdb3e6e47bb3b45941b824063362c53d6e3e0e6b2e7c3b2e2366

Contents?: true

Size: 1007 Bytes

Versions: 13

Compression:

Stored size: 1007 Bytes

Contents

#!/usr/bin/env ruby

require 'syslogstash'
require 'yaml'

if ARGV.length != 1
	$stderr.puts <<-EOF.gsub(/^\t\t/, '')
		Invalid usage

		Usage:
		  #{$0} <configfile>
	EOF

	exit 1
end

unless File.exist?(ARGV[0])
	$stderr.puts "Config file #{ARGV[0]} does not exist"
	exit 1
end

unless File.readable?(ARGV[0])
	$stderr.puts "Config file #{ARGV[0]} not readable"
	exit 1
end

cfg = YAML.load_file(ARGV[0])

unless cfg.is_a? Hash
	$stderr.puts "Config file #{ARGV[0]} does not contain a YAML hash"
	exit 1
end

%w{sockets servers}.each do |section|
	unless cfg.has_key?(section)
		$stderr.puts "Config file #{ARGV[0]} does not have a '#{section}' section"
		exit 1
	end

	unless cfg[section].respond_to?(:empty?)
		$stderr.puts "Config file #{ARGV[0]} has a malformed '#{section}' section"
		exit 1
	end

	if cfg[section].empty?
		$stderr.puts "Config file #{ARGV[0]} has an empty '#{section}' section"
		exit 1
	end
end

Syslogstash.new(cfg['sockets'], cfg['servers'], cfg.fetch('backlog', 1_000_000)).run

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
syslogstash-1.3.0 bin/syslogstash
syslogstash-1.2.1 bin/syslogstash
syslogstash-1.2.0 bin/syslogstash
syslogstash-1.1.2 bin/syslogstash
syslogstash-1.1.1 bin/syslogstash
syslogstash-1.1.0 bin/syslogstash
syslogstash-1.0.2 bin/syslogstash
syslogstash-1.0.1 bin/syslogstash
syslogstash-1.0.0 bin/syslogstash
syslogstash-0.4.1 bin/syslogstash
syslogstash-0.4.0 bin/syslogstash
syslogstash-0.3.0 bin/syslogstash
syslogstash-0.2.0 bin/syslogstash