forked from elastic/logstash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Push a logstash-test script to aid in debugging common logstash setup
problems.
- Loading branch information
1 parent
710d7a6
commit 2b14cba
Showing
5 changed files
with
92 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require "rubygems" | ||
require "optparse" | ||
$:.unshift "#{File.dirname(__FILE__)}/../lib" | ||
$:.unshift "#{File.dirname(__FILE__)}/../test" | ||
|
||
#require "logstash/test_syntax" | ||
#require "logstash/filters/test_date" | ||
#require "logstash/filters/test_multiline" | ||
|
||
def check_lib(lib, provider, optional=true, message=nil) | ||
begin | ||
require lib | ||
puts "+ Found #{optional ? "optional" : "required"} library '#{lib}'" | ||
return { :optional => optional, :found => true } | ||
rescue LoadError => e | ||
puts "- Missing #{optional ? "optional" : "required"} library '#{lib}' - try 'gem install #{provider}'#{optional ? " if you want this library" : ""}. #{message}" | ||
return { :optional => optional, :found => false } | ||
end | ||
end | ||
|
||
def report_ruby_version | ||
puts "Running #{RUBY_VERSION}p#{RUBY_PATCHLEVEL} on #{RUBY_PLATFORM}" | ||
end | ||
|
||
def check_libraries | ||
results = [] | ||
results << check_lib("em-http-request", "em-http-request", true, | ||
"needed for ElasticSearch input, output, and logstash-web support.") | ||
results << check_lib("em-mongo", "em-mongo", true, | ||
"needed for the mongodb output.") | ||
results << check_lib("grok", "jls-grok", true, | ||
"needed for the grok filter.") | ||
results << check_lib("em-websocket", "em-websocket", true, | ||
"needed for websocket output") | ||
results << check_lib("rack", "rack", true, | ||
"needed for logstash-web") | ||
results << check_lib("amqp", "amqp", true, | ||
"needed for AMQP input and output") | ||
results << check_lib("sinatra/async", "async_sinatra", true, | ||
"needed for logstash-web") | ||
results << check_lib("uuidtools", "uuidtools", true, | ||
"needed for AMQP input and output") | ||
results << check_lib("ap", "awesome_print", true, | ||
"improve logstash debug logging output") | ||
results << check_lib("eventmachine", "eventmachine", false, | ||
"required for logstash to function") | ||
|
||
missing_required = results.count { |r| !r[:optional] and !r[:found] } | ||
if missing_required == 0 | ||
puts "All required libraries found :)" | ||
else | ||
suffix = (missing_required > 1) ? "ies" : "y" | ||
puts "FATAL: Missing #{missing_required} required librar#{suffix}" | ||
return false | ||
end | ||
|
||
return true | ||
end | ||
|
||
def run_tests | ||
require "logstash/test_syntax" | ||
require "logstash/filters/test_date" | ||
require "logstash/filters/test_multiline" | ||
return Test::Unit::AutoRunner.run | ||
end | ||
|
||
def main(args) | ||
report_ruby_version | ||
if !check_libraries | ||
puts "Library check failed." | ||
return 1 | ||
end | ||
|
||
if !run_tests | ||
puts "Test suite failed." | ||
return 1 | ||
end | ||
|
||
return 0 | ||
end | ||
|
||
exit(main(ARGV)) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ Gem::Specification.new do |spec| | |
spec.bindir = "bin" | ||
spec.executables << "logstash" | ||
spec.executables << "logstash-web" | ||
spec.executables << "logstash-test" | ||
|
||
spec.author = "Jordan Sissel" | ||
spec.email = "[email protected]" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ Gem::Specification.new do |spec| | |
spec.bindir = "bin" | ||
spec.executables << "logstash" | ||
spec.executables << "logstash-web" | ||
spec.executables << "logstash-test" | ||
|
||
spec.author = "Jordan Sissel" | ||
spec.email = "[email protected]" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
require "rubygems" | ||
$:.unshift "#{File.dirname(__FILE__)}/../lib/" | ||
|
||
require "test_syntax" | ||
require "filters/test_date" | ||
require "filters/test_multiline" | ||
require "logstash/test_syntax" | ||
require "logstash/filters/test_date" | ||
require "logstash/filters/test_multiline" |