logstash-core 1.5.2.2-java → 1.5.3-java
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of logstash-core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/logstash/agent.rb +15 -1
- data/lib/logstash/environment.rb +8 -0
- data/lib/logstash/outputs/base.rb +1 -1
- data/lib/logstash/patches.rb +1 -0
- data/lib/logstash/patches/stronger_openssl_defaults.rb +62 -0
- data/lib/logstash/pipeline.rb +3 -0
- data/lib/logstash/plugin.rb +4 -4
- data/lib/logstash/util/plugin_version.rb +14 -2
- data/lib/logstash/util/reporter.rb +27 -0
- data/lib/logstash/util/unicode_trimmer.rb +1 -1
- data/lib/logstash/version.rb +1 -1
- data/logstash-core.gemspec +2 -2
- data/spec/core/environment_spec.rb +11 -0
- data/spec/core/plugin_spec.rb +16 -0
- data/spec/coverage_helper.rb +11 -2
- data/spec/logstash/agent_spec.rb +25 -1
- data/spec/logstash/patches_spec.rb +25 -0
- data/spec/util/plugin_version_spec.rb +17 -2
- data/spec/util/unicode_trimmer_spec.rb +9 -7
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d44a36ab493256fbc2305fd3747b94dc9dd45a2b
|
4
|
+
data.tar.gz: dc976fcaf28589a88b2e0183a1365f3ea096effc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44d5d3b875f34ce9a038a31b18b60f7d2b1d9879c43dca7d14c07b16b00c558b303ac49e61024236a72fdd794e6a1c07d64fe54d7049e05a54dd4f900af392a3
|
7
|
+
data.tar.gz: c75f08d03c18e6aa17310b58293676be495004b34ec695c8132099ba718682e1596666a125d9b2c9c49f03c3db655974e991542420920f21f3556795619299d0
|
data/lib/logstash/agent.rb
CHANGED
@@ -39,6 +39,11 @@ class LogStash::Agent < Clamp::Command
|
|
39
39
|
option ["-V", "--version"], :flag,
|
40
40
|
I18n.t("logstash.agent.flag.version")
|
41
41
|
|
42
|
+
option ["-p", "--pluginpath"] , "PATH",
|
43
|
+
I18n.t("logstash.agent.flag.pluginpath"),
|
44
|
+
:multivalued => true,
|
45
|
+
:attribute_name => :plugin_paths
|
46
|
+
|
42
47
|
option ["-t", "--configtest"], :flag,
|
43
48
|
I18n.t("logstash.agent.flag.configtest"),
|
44
49
|
:attribute_name => :config_test
|
@@ -204,6 +209,7 @@ class LogStash::Agent < Clamp::Command
|
|
204
209
|
# Log file stuff, plugin path checking, etc.
|
205
210
|
def configure
|
206
211
|
configure_logging(log_file)
|
212
|
+
configure_plugin_paths(plugin_paths)
|
207
213
|
end # def configure
|
208
214
|
|
209
215
|
# Point logging at a specific path.
|
@@ -229,7 +235,6 @@ class LogStash::Agent < Clamp::Command
|
|
229
235
|
else
|
230
236
|
@logger.level = :warn
|
231
237
|
end
|
232
|
-
|
233
238
|
end
|
234
239
|
|
235
240
|
if log_file
|
@@ -254,6 +259,15 @@ class LogStash::Agent < Clamp::Command
|
|
254
259
|
# http://jira.codehaus.org/browse/JRUBY-7003
|
255
260
|
end # def configure_logging
|
256
261
|
|
262
|
+
# add the given paths for ungemified/bare plugins lookups
|
263
|
+
# @param paths [String, Array<String>] plugins path string or list of path strings to add
|
264
|
+
def configure_plugin_paths(paths)
|
265
|
+
Array(paths).each do |path|
|
266
|
+
fail(I18n.t("logstash.agent.configuration.plugin_path_missing", :path => path)) unless File.directory?(path)
|
267
|
+
LogStash::Environment.add_plugin_path(path)
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
257
271
|
def load_config(path)
|
258
272
|
begin
|
259
273
|
uri = URI.parse(path)
|
data/lib/logstash/environment.rb
CHANGED
@@ -99,6 +99,14 @@ module LogStash
|
|
99
99
|
I18n.reload!
|
100
100
|
fail "No locale? This is a bug." if I18n.available_locales.empty?
|
101
101
|
end
|
102
|
+
|
103
|
+
# add path for bare/ungemified plugins lookups. the path must be the base path that will include
|
104
|
+
# the dir structure 'logstash/TYPE/NAME.rb' where TYPE is 'inputs' 'filters', 'outputs' or 'codecs'
|
105
|
+
# and NAME is the name of the plugin
|
106
|
+
# @param path [String] plugins path to add
|
107
|
+
def add_plugin_path(path)
|
108
|
+
$LOAD_PATH << path
|
109
|
+
end
|
102
110
|
end
|
103
111
|
end
|
104
112
|
|
@@ -33,7 +33,7 @@ class LogStash::Outputs::Base < LogStash::Plugin
|
|
33
33
|
# Note that this setting may not be useful for all outputs.
|
34
34
|
config :workers, :validate => :number, :default => 1
|
35
35
|
|
36
|
-
attr_reader :worker_plugins
|
36
|
+
attr_reader :worker_plugins, :worker_queue
|
37
37
|
|
38
38
|
public
|
39
39
|
def workers_not_supported(message=nil)
|
data/lib/logstash/patches.rb
CHANGED
@@ -0,0 +1,62 @@
|
|
1
|
+
|
2
|
+
require "openssl"
|
3
|
+
|
4
|
+
# :nodoc:
|
5
|
+
class OpenSSL::SSL::SSLContext
|
6
|
+
# Wrap SSLContext.new to a stronger default settings.
|
7
|
+
class << self
|
8
|
+
alias_method :orig_new, :new
|
9
|
+
def new(*args)
|
10
|
+
c = orig_new(*args)
|
11
|
+
|
12
|
+
# MRI nor JRuby seem to actually invoke `SSLContext#set_params` by
|
13
|
+
# default, which makes the default ciphers (and other settings) not
|
14
|
+
# actually defaults. Oops!
|
15
|
+
# To force this, and force our (hopefully more secure) defaults on
|
16
|
+
# all things using openssl in Ruby, we will invoke set_params
|
17
|
+
# on all new SSLContext objects.
|
18
|
+
c.set_params
|
19
|
+
c
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# This cipher selection comes from https://wiki.mozilla.org/Security/Server_Side_TLS
|
24
|
+
MOZILLA_INTERMEDIATE_CIPHERS = "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA"
|
25
|
+
|
26
|
+
# Returns the value that should be used for the default SSLContext options
|
27
|
+
#
|
28
|
+
# This is a method instead of a constant because some constants (like
|
29
|
+
# OpenSSL::SSL::OP_NO_COMPRESSION) may not be available in all Ruby
|
30
|
+
# versions/platforms.
|
31
|
+
def self.__default_options
|
32
|
+
# ruby-core is refusing to patch ruby's default openssl settings to be more
|
33
|
+
# secure, so let's fix that here. The next few lines setting options and
|
34
|
+
# ciphers come from jmhodges' proposed patch
|
35
|
+
ssloptions = OpenSSL::SSL::OP_ALL
|
36
|
+
|
37
|
+
# TODO(sissel): JRuby doesn't have this. Maybe work on a fix?
|
38
|
+
if defined?(OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS)
|
39
|
+
ssloptions &= ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS
|
40
|
+
end
|
41
|
+
|
42
|
+
# TODO(sissel): JRuby doesn't have this. Maybe work on a fix?
|
43
|
+
if defined?(OpenSSL::SSL::OP_NO_COMPRESSION)
|
44
|
+
ssloptions |= OpenSSL::SSL::OP_NO_COMPRESSION
|
45
|
+
end
|
46
|
+
|
47
|
+
# Disable SSLv2 and SSLv3. They are insecure and highly discouraged.
|
48
|
+
ssloptions |= OpenSSL::SSL::OP_NO_SSLv2 if defined?(OpenSSL::SSL::OP_NO_SSLv2)
|
49
|
+
ssloptions |= OpenSSL::SSL::OP_NO_SSLv3 if defined?(OpenSSL::SSL::OP_NO_SSLv3)
|
50
|
+
ssloptions
|
51
|
+
end
|
52
|
+
|
53
|
+
# Overwriting the DEFAULT_PARAMS const idea from here: https://www.ruby-lang.org/en/news/2014/10/27/changing-default-settings-of-ext-openssl/
|
54
|
+
remove_const(:DEFAULT_PARAMS) if const_defined?(:DEFAULT_PARAMS)
|
55
|
+
DEFAULT_PARAMS = {
|
56
|
+
:ssl_version => "SSLv23",
|
57
|
+
:verify_mode => OpenSSL::SSL::VERIFY_PEER,
|
58
|
+
:ciphers => MOZILLA_INTERMEDIATE_CIPHERS,
|
59
|
+
:options => __default_options # Not a constant because it's computed at start-time.
|
60
|
+
}
|
61
|
+
|
62
|
+
end
|
data/lib/logstash/pipeline.rb
CHANGED
@@ -8,6 +8,7 @@ require "logstash/config/file"
|
|
8
8
|
require "logstash/filters/base"
|
9
9
|
require "logstash/inputs/base"
|
10
10
|
require "logstash/outputs/base"
|
11
|
+
require "logstash/util/reporter"
|
11
12
|
|
12
13
|
class LogStash::Pipeline
|
13
14
|
|
@@ -252,6 +253,8 @@ class LogStash::Pipeline
|
|
252
253
|
#
|
253
254
|
# This method is intended to be called from another thread
|
254
255
|
def shutdown
|
256
|
+
InflightEventsReporter.logger = @logger
|
257
|
+
InflightEventsReporter.start(@input_to_filter, @filter_to_output, @outputs)
|
255
258
|
@input_threads.each do |thread|
|
256
259
|
# Interrupt all inputs
|
257
260
|
@logger.info("Sending shutdown signal to input thread", :thread => thread)
|
data/lib/logstash/plugin.rb
CHANGED
@@ -111,10 +111,10 @@ class LogStash::Plugin
|
|
111
111
|
|
112
112
|
public
|
113
113
|
def inspect
|
114
|
-
if !@
|
115
|
-
description = @
|
116
|
-
.
|
117
|
-
.collect { |k,v| "#{k}=>#{v.inspect}" }
|
114
|
+
if !@params.nil?
|
115
|
+
description = @params
|
116
|
+
.reject { |k, v| v.nil? || (v.respond_to?(:empty?) && v.empty?) }
|
117
|
+
.collect { |k, v| "#{k}=>#{v.inspect}" }
|
118
118
|
return "<#{self.class.name} #{description.join(", ")}>"
|
119
119
|
else
|
120
120
|
return "<#{self.class.name} --->"
|
@@ -22,8 +22,14 @@ module LogStash::Util
|
|
22
22
|
|
23
23
|
def self.find_version!(name)
|
24
24
|
begin
|
25
|
-
|
26
|
-
|
25
|
+
spec = Gem::Specification.find_by_name(name)
|
26
|
+
if spec.nil?
|
27
|
+
# Checking for nil? is a workaround for situations where find_by_name
|
28
|
+
# is not able to find the real spec, as for example with pre releases
|
29
|
+
# of plugins
|
30
|
+
spec = Gem::Specification.find_all_by_name(name).first
|
31
|
+
end
|
32
|
+
new(spec.version)
|
27
33
|
rescue Gem::LoadError
|
28
34
|
# Rescuing the LoadError and raise a Logstash specific error.
|
29
35
|
# Likely we can't find the gem in the current GEM_PATH
|
@@ -39,5 +45,11 @@ module LogStash::Util
|
|
39
45
|
def <=>(other)
|
40
46
|
version <=> other.version
|
41
47
|
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def self.build_from_spec(spec)
|
52
|
+
new(spec.version)
|
53
|
+
end
|
42
54
|
end
|
43
55
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class InflightEventsReporter
|
2
|
+
def self.logger=(logger)
|
3
|
+
@logger = logger
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.start(input_to_filter, filter_to_output, outputs)
|
7
|
+
Thread.new do
|
8
|
+
loop do
|
9
|
+
sleep 5
|
10
|
+
report(input_to_filter, filter_to_output, outputs)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.report(input_to_filter, filter_to_output, outputs)
|
16
|
+
report = {
|
17
|
+
"input_to_filter" => input_to_filter.size,
|
18
|
+
"filter_to_output" => filter_to_output.size,
|
19
|
+
"outputs" => []
|
20
|
+
}
|
21
|
+
outputs.each do |output|
|
22
|
+
next unless output.worker_queue && output.worker_queue.size > 0
|
23
|
+
report["outputs"] << [output.inspect, output.worker_queue.size]
|
24
|
+
end
|
25
|
+
@logger.warn ["INFLIGHT_EVENTS_REPORT", Time.now.iso8601, report]
|
26
|
+
end
|
27
|
+
end
|
data/lib/logstash/version.rb
CHANGED
data/logstash-core.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
16
16
|
gem.name = "logstash-core"
|
17
17
|
gem.require_paths = ["lib"]
|
18
|
-
gem.version =
|
18
|
+
gem.version = LOGSTASH_VERSION.gsub(/-/, '.')
|
19
19
|
|
20
20
|
gem.add_runtime_dependency "cabin", "~> 0.7.0" #(Apache 2.0 license)
|
21
21
|
gem.add_runtime_dependency "pry", "~> 0.10.1" #(Ruby license)
|
@@ -37,7 +37,7 @@ Gem::Specification.new do |gem|
|
|
37
37
|
|
38
38
|
if RUBY_PLATFORM == 'java'
|
39
39
|
gem.platform = RUBY_PLATFORM
|
40
|
-
gem.add_runtime_dependency "jrjackson", "~> 0.2.
|
40
|
+
gem.add_runtime_dependency "jrjackson", "~> 0.2.9" #(Apache 2.0 license)
|
41
41
|
else
|
42
42
|
gem.add_runtime_dependency "oj" #(MIT-style license)
|
43
43
|
end
|
@@ -38,7 +38,18 @@ describe LogStash::Environment do
|
|
38
38
|
allow(Dir).to receive(:glob).and_return([])
|
39
39
|
expect { subject.load_runtime_jars! }.to raise_error
|
40
40
|
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "add_plugin_path" do
|
45
|
+
let(:path) { "/some/path" }
|
46
|
+
|
47
|
+
before(:each) { expect($LOAD_PATH).to_not include(path) }
|
48
|
+
after(:each) { $LOAD_PATH.delete(path) }
|
41
49
|
|
50
|
+
it "should add the path to $LOAD_PATH" do
|
51
|
+
expect{subject.add_plugin_path(path)}.to change{$LOAD_PATH.size}.by(1)
|
52
|
+
expect($LOAD_PATH).to include(path)
|
42
53
|
end
|
43
54
|
end
|
44
55
|
end
|
data/spec/core/plugin_spec.rb
CHANGED
@@ -29,6 +29,22 @@ describe LogStash::Plugin do
|
|
29
29
|
expect(LogStash::Plugin.lookup("filter", "lady_gaga")).to eq(LogStash::Filters::LadyGaga)
|
30
30
|
end
|
31
31
|
|
32
|
+
describe "#inspect" do
|
33
|
+
class LogStash::Filters::MyTestFilter < LogStash::Filters::Base
|
34
|
+
config_name "param1"
|
35
|
+
config :num, :validate => :number, :default => 20
|
36
|
+
config :str, :validate => :string, :default => "test"
|
37
|
+
end
|
38
|
+
subject { LogStash::Filters::MyTestFilter.new("num" => 1, "str" => "hello") }
|
39
|
+
|
40
|
+
it "should print the class of the filter" do
|
41
|
+
expect(subject.inspect).to match(/^<LogStash::Filters::MyTestFilter/)
|
42
|
+
end
|
43
|
+
it "should list config options and values" do
|
44
|
+
expect(subject.inspect).to match(/num=>1, str=>"hello"/)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
32
48
|
context "when validating the plugin version" do
|
33
49
|
let(:plugin_name) { 'logstash-filter-stromae' }
|
34
50
|
subject do
|
data/spec/coverage_helper.rb
CHANGED
@@ -2,11 +2,20 @@
|
|
2
2
|
# running coverage analysis
|
3
3
|
module CoverageHelper
|
4
4
|
|
5
|
-
|
5
|
+
##
|
6
|
+
# Skip list used to avoid loading certain patterns within
|
7
|
+
# the logstash directories, this patterns are excluded becuause
|
8
|
+
# of potential problems or because they are going to be loaded
|
9
|
+
# in another way.
|
10
|
+
##
|
11
|
+
SKIP_LIST = Regexp.union([
|
12
|
+
/^lib\/bootstrap\/rspec.rb$/,
|
13
|
+
/^lib\/logstash\/util\/prctl.rb$/
|
14
|
+
])
|
6
15
|
|
7
16
|
def self.eager_load
|
8
17
|
Dir.glob("lib/**/*.rb") do |file|
|
9
|
-
next if SKIP_LIST
|
18
|
+
next if file =~ SKIP_LIST
|
10
19
|
require file
|
11
20
|
end
|
12
21
|
end
|
data/spec/logstash/agent_spec.rb
CHANGED
@@ -22,7 +22,7 @@ describe LogStash::Agent do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
context "when remote" do
|
27
27
|
context 'supported scheme' do
|
28
28
|
let(:path) { "http://test.local/superconfig.conf" }
|
@@ -34,4 +34,28 @@ describe LogStash::Agent do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
38
|
+
context "--pluginpath" do
|
39
|
+
let(:single_path) { "/some/path" }
|
40
|
+
let(:multiple_paths) { ["/some/path1", "/some/path2"] }
|
41
|
+
|
42
|
+
it "should add single valid dir path to the environment" do
|
43
|
+
expect(File).to receive(:directory?).and_return(true)
|
44
|
+
expect(LogStash::Environment).to receive(:add_plugin_path).with(single_path)
|
45
|
+
subject.configure_plugin_paths(single_path)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should fail with single invalid dir path" do
|
49
|
+
expect(File).to receive(:directory?).and_return(false)
|
50
|
+
expect(LogStash::Environment).not_to receive(:add_plugin_path)
|
51
|
+
expect{subject.configure_plugin_paths(single_path)}.to raise_error(LogStash::ConfigurationError)
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should add multiple valid dir path to the environment" do
|
55
|
+
expect(File).to receive(:directory?).exactly(multiple_paths.size).times.and_return(true)
|
56
|
+
multiple_paths.each{|path| expect(LogStash::Environment).to receive(:add_plugin_path).with(path)}
|
57
|
+
subject.configure_plugin_paths(multiple_paths)
|
58
|
+
end
|
59
|
+
end
|
37
60
|
end
|
61
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "logstash/patches"
|
2
|
+
|
3
|
+
describe "OpenSSL defaults" do
|
4
|
+
subject { OpenSSL::SSL::SSLContext.new }
|
5
|
+
|
6
|
+
# OpenSSL::SSL::SSLContext#ciphers returns an array of
|
7
|
+
# [ [ ciphername, version, bits, alg_bits ], [ ... ], ... ]
|
8
|
+
|
9
|
+
# List of cipher names
|
10
|
+
let(:ciphers) { subject.ciphers.map(&:first) }
|
11
|
+
|
12
|
+
# List of cipher encryption bit strength.
|
13
|
+
let(:encryption_bits) { subject.ciphers.map { |_, _, _, a| a } }
|
14
|
+
|
15
|
+
it "should not include any export ciphers" do
|
16
|
+
# SSLContext#ciphers returns an array of [ciphername, tlsversion, key_bits, alg_bits]
|
17
|
+
# Let's just check the cipher names
|
18
|
+
expect(ciphers).not_to be_any { |name| name =~ /EXPORT/ || name =~ /^EXP/ }
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should not include any weak ciphers (w/ less than 128 bits in encryption algorithm)" do
|
22
|
+
# SSLContext#ciphers returns an array of [ciphername, tlsversion, key_bits, alg_bits]
|
23
|
+
expect(encryption_bits).not_to be_any { |bits| bits < 128 }
|
24
|
+
end
|
25
|
+
end
|
@@ -1,18 +1,33 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
require "logstash/util/plugin_version"
|
3
3
|
|
4
|
-
describe LogStash::Util::PluginVersion do
|
4
|
+
describe "LogStash::Util::PluginVersion" do
|
5
|
+
|
5
6
|
subject { LogStash::Util::PluginVersion }
|
6
7
|
|
7
8
|
context "#find_version!" do
|
9
|
+
|
10
|
+
let(:gem) { "bundler" }
|
11
|
+
|
8
12
|
it 'raises an PluginNoVersionError if we cant find the plugin in the gem path' do
|
9
13
|
dummy_name ='this-character-doesnt-exist-in-the-marvel-universe'
|
10
14
|
expect { subject.find_version!(dummy_name) }.to raise_error(LogStash::PluginNoVersionError)
|
11
15
|
end
|
12
16
|
|
13
17
|
it 'returns the version of the gem' do
|
14
|
-
expect { subject.find_version!(
|
18
|
+
expect { subject.find_version!(gem) }.not_to raise_error
|
15
19
|
end
|
20
|
+
|
21
|
+
context "with a pre release gem" do
|
22
|
+
|
23
|
+
it 'return the version of the gem' do
|
24
|
+
# Gem::Specification.find_by_name return nil if the gem is not activated, as for
|
25
|
+
# example the pre release ones.
|
26
|
+
expect(Gem::Specification).to receive(:find_by_name).and_return(nil)
|
27
|
+
expect { subject.find_version!(gem) }.not_to raise_error
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
16
31
|
end
|
17
32
|
|
18
33
|
context "#new" do
|
@@ -9,19 +9,21 @@ RSpec.configure do |config|
|
|
9
9
|
end
|
10
10
|
|
11
11
|
describe "truncating unicode strings correctly" do
|
12
|
+
subject { LogStash::Util::UnicodeTrimmer }
|
13
|
+
|
12
14
|
context "with extra bytes before the snip" do
|
13
15
|
let(:ustr) { "Testing «ταБЬℓσ»: 1<2 & 4+1>3, now 20% off!" }
|
14
16
|
|
15
17
|
it "should truncate to exact byte boundaries when possible" do
|
16
|
-
expect(
|
18
|
+
expect(subject.trim_bytes(ustr, 21).bytesize).to eql(21)
|
17
19
|
end
|
18
20
|
|
19
21
|
it "should truncate below the bytesize when splitting a byte" do
|
20
|
-
expect(
|
22
|
+
expect(subject.trim_bytes(ustr, 20).bytesize).to eql(18)
|
21
23
|
end
|
22
24
|
|
23
25
|
it "should not truncate the string when the bytesize is already OK" do
|
24
|
-
expect(
|
26
|
+
expect(subject.trim_bytes(ustr, ustr.bytesize)).to eql(ustr)
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
@@ -29,15 +31,15 @@ describe "truncating unicode strings correctly" do
|
|
29
31
|
let(:ustr) { ": 1<2 & 4+1>3, now 20% off! testing «ταБЬℓσ»" }
|
30
32
|
|
31
33
|
it "should truncate to exact byte boundaries when possible" do
|
32
|
-
expect(
|
34
|
+
expect(subject.trim_bytes(ustr, 21).bytesize).to eql(21)
|
33
35
|
end
|
34
36
|
|
35
37
|
it "should truncate below the bytesize when splitting a byte" do
|
36
|
-
expect(
|
38
|
+
expect(subject.trim_bytes(ustr, 52).bytesize).to eql(51)
|
37
39
|
end
|
38
40
|
|
39
41
|
it "should not truncate the string when the bytesize is already OK" do
|
40
|
-
expect(
|
42
|
+
expect(subject.trim_bytes(ustr, ustr.bytesize)).to eql(ustr)
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
@@ -47,7 +49,7 @@ describe "truncating unicode strings correctly" do
|
|
47
49
|
let(:expected_range) { (size - 4)..size }
|
48
50
|
|
49
51
|
stress_it "should be near the boundary of requested size" do
|
50
|
-
expect(expected_range).to include(
|
52
|
+
expect(expected_range).to include(subject.trim_bytes(text, size).bytesize)
|
51
53
|
end
|
52
54
|
end
|
53
55
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Jordan Sissel
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-07-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: cabin
|
@@ -158,12 +158,12 @@ dependencies:
|
|
158
158
|
requirements:
|
159
159
|
- - ~>
|
160
160
|
- !ruby/object:Gem::Version
|
161
|
-
version: 0.2.
|
161
|
+
version: 0.2.9
|
162
162
|
requirement: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - ~>
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0.2.
|
166
|
+
version: 0.2.9
|
167
167
|
prerelease: false
|
168
168
|
type: :runtime
|
169
169
|
description: The core components of logstash, the scalable log and event management tool
|
@@ -201,6 +201,7 @@ files:
|
|
201
201
|
- lib/logstash/patches/cabin.rb
|
202
202
|
- lib/logstash/patches/profile_require_calls.rb
|
203
203
|
- lib/logstash/patches/rubygems.rb
|
204
|
+
- lib/logstash/patches/stronger_openssl_defaults.rb
|
204
205
|
- lib/logstash/pipeline.rb
|
205
206
|
- lib/logstash/plugin.rb
|
206
207
|
- lib/logstash/program.rb
|
@@ -219,6 +220,7 @@ files:
|
|
219
220
|
- lib/logstash/util/password.rb
|
220
221
|
- lib/logstash/util/plugin_version.rb
|
221
222
|
- lib/logstash/util/prctl.rb
|
223
|
+
- lib/logstash/util/reporter.rb
|
222
224
|
- lib/logstash/util/require-helper.rb
|
223
225
|
- lib/logstash/util/retryable.rb
|
224
226
|
- lib/logstash/util/socket_peer.rb
|
@@ -242,6 +244,7 @@ files:
|
|
242
244
|
- spec/lib/logstash/java_integration_spec.rb
|
243
245
|
- spec/license_spec.rb
|
244
246
|
- spec/logstash/agent_spec.rb
|
247
|
+
- spec/logstash/patches_spec.rb
|
245
248
|
- spec/outputs/base_spec.rb
|
246
249
|
- spec/spec_helper.rb
|
247
250
|
- spec/util/accessors_spec.rb
|
@@ -293,6 +296,7 @@ test_files:
|
|
293
296
|
- spec/lib/logstash/java_integration_spec.rb
|
294
297
|
- spec/license_spec.rb
|
295
298
|
- spec/logstash/agent_spec.rb
|
299
|
+
- spec/logstash/patches_spec.rb
|
296
300
|
- spec/outputs/base_spec.rb
|
297
301
|
- spec/spec_helper.rb
|
298
302
|
- spec/util/accessors_spec.rb
|