logstash-core 6.1.4-java → 6.2.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/lib/logstash-core/logstash-core.rb +10 -31
  3. data/lib/logstash/agent.rb +3 -23
  4. data/lib/logstash/api/modules/logging.rb +11 -0
  5. data/lib/logstash/config/source/multi_local.rb +5 -3
  6. data/lib/logstash/environment.rb +10 -3
  7. data/lib/logstash/event.rb +0 -1
  8. data/lib/logstash/filter_delegator.rb +1 -2
  9. data/lib/logstash/inputs/base.rb +1 -1
  10. data/lib/logstash/instrument/periodic_poller/base.rb +4 -4
  11. data/lib/logstash/instrument/periodic_poller/jvm.rb +5 -3
  12. data/lib/logstash/java_filter_delegator.rb +1 -2
  13. data/lib/logstash/java_pipeline.rb +6 -2
  14. data/lib/logstash/modules/kibana_client.rb +1 -1
  15. data/lib/logstash/output_delegator.rb +2 -3
  16. data/lib/logstash/output_delegator_strategies/legacy.rb +4 -4
  17. data/lib/logstash/output_delegator_strategies/shared.rb +4 -4
  18. data/lib/logstash/output_delegator_strategies/single.rb +2 -2
  19. data/lib/logstash/pipeline.rb +16 -24
  20. data/lib/logstash/plugin.rb +1 -1
  21. data/lib/logstash/plugins/plugin_factory.rb +3 -4
  22. data/lib/logstash/runner.rb +5 -0
  23. data/lib/logstash/settings.rb +5 -0
  24. data/lib/logstash/timestamp.rb +2 -25
  25. data/lib/logstash/util/secretstore.rb +36 -0
  26. data/lib/logstash/util/settings_helper.rb +1 -0
  27. data/lib/logstash/util/substitution_variables.rb +18 -5
  28. data/lib/logstash/util/wrapped_acked_queue.rb +1 -1
  29. data/lib/logstash/util/wrapped_synchronous_queue.rb +3 -35
  30. data/locales/en.yml +4 -4
  31. data/logstash-core.gemspec +0 -7
  32. data/spec/conditionals_spec.rb +21 -24
  33. data/spec/logstash/filter_delegator_spec.rb +3 -4
  34. data/spec/logstash/java_filter_delegator_spec.rb +3 -4
  35. data/spec/logstash/java_pipeline_spec.rb +97 -2
  36. data/spec/logstash/legacy_ruby_timestamp_spec.rb +0 -1
  37. data/spec/logstash/output_delegator_spec.rb +5 -7
  38. data/spec/logstash/queue_factory_spec.rb +1 -1
  39. data/spec/logstash/settings_spec.rb +49 -22
  40. data/spec/logstash/timestamp_spec.rb +0 -1
  41. data/spec/logstash/util/secretstore_spec.rb +69 -0
  42. data/spec/support/mocks_classes.rb +21 -0
  43. data/versions-gem-copy.yml +2 -2
  44. metadata +6 -42
  45. data/gemspec_jars.rb +0 -12
  46. data/lib/logstash-core/logstash-core.jar +0 -0
  47. data/lib/logstash-core_jars.rb +0 -28
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
2
  require "spec_helper"
3
- require "logstash/timestamp"
4
3
  require "bigdecimal"
5
4
 
6
5
  describe LogStash::Timestamp do
@@ -11,7 +11,6 @@ describe LogStash::OutputDelegator do
11
11
  end
12
12
  end
13
13
 
14
- let(:logger) { double("logger") }
15
14
  let(:events) { 7.times.map { LogStash::Event.new }}
16
15
  let(:plugin_args) { {"id" => "foo", "arg1" => "val1"} }
17
16
  let(:collector) { [] }
@@ -22,7 +21,7 @@ describe LogStash::OutputDelegator do
22
21
 
23
22
  include_context "execution_context"
24
23
 
25
- subject { described_class.new(logger, out_klass, metric, execution_context, ::LogStash::OutputDelegatorStrategyRegistry.instance, plugin_args) }
24
+ subject { described_class.new(out_klass, metric, execution_context, ::LogStash::OutputDelegatorStrategyRegistry.instance, plugin_args) }
26
25
 
27
26
  context "with a plain output plugin" do
28
27
  let(:out_klass) { double("output klass") }
@@ -47,7 +46,6 @@ describe LogStash::OutputDelegator do
47
46
  allow(out_inst).to receive(:id).and_return("a-simple-plugin")
48
47
 
49
48
  allow(subject.metric_events).to receive(:increment).with(any_args)
50
- allow(logger).to receive(:debug).with(any_args)
51
49
  end
52
50
 
53
51
  it "should initialize cleanly" do
@@ -56,7 +54,7 @@ describe LogStash::OutputDelegator do
56
54
 
57
55
  it "should push the name of the plugin to the metric" do
58
56
  expect(metric).to receive(:gauge).with(:name, out_klass.config_name)
59
- described_class.new(logger, out_klass, metric, execution_context, ::LogStash::OutputDelegatorStrategyRegistry.instance, plugin_args)
57
+ described_class.new(out_klass, metric, execution_context, ::LogStash::OutputDelegatorStrategyRegistry.instance, plugin_args)
60
58
  end
61
59
 
62
60
  context "after having received a batch of events" do
@@ -112,7 +110,7 @@ describe LogStash::OutputDelegator do
112
110
  it "should find the correct concurrency type for the output" do
113
111
  expect(subject.concurrency).to eq(strategy_concurrency)
114
112
  end
115
-
113
+
116
114
  it "should find the correct Strategy class for the worker" do
117
115
  expect(subject.strategy).to be_a(klass)
118
116
  end
@@ -130,7 +128,7 @@ describe LogStash::OutputDelegator do
130
128
  before do
131
129
  allow(subject.strategy).to receive(method)
132
130
  end
133
-
131
+
134
132
  it "should delegate #{method} to the strategy" do
135
133
  subject.send(method, *args)
136
134
  if args
@@ -145,7 +143,7 @@ describe LogStash::OutputDelegator do
145
143
  before do
146
144
  allow(out_inst).to receive(method)
147
145
  end
148
-
146
+
149
147
  it "should delegate #{method} to the strategy" do
150
148
  subject.send(method, *args)
151
149
  if args
@@ -9,7 +9,7 @@ describe LogStash::QueueFactory do
9
9
  [
10
10
  LogStash::Setting::WritableDirectory.new("path.queue", Stud::Temporary.pathname),
11
11
  LogStash::Setting::String.new("queue.type", "memory", true, ["persisted", "memory", "memory_acked"]),
12
- LogStash::Setting::Bytes.new("queue.page_capacity", "250mb"),
12
+ LogStash::Setting::Bytes.new("queue.page_capacity", "64mb"),
13
13
  LogStash::Setting::Bytes.new("queue.max_bytes", "1024mb"),
14
14
  LogStash::Setting::Numeric.new("queue.max_events", 0),
15
15
  LogStash::Setting::Numeric.new("queue.checkpoint.acks", 1024),
@@ -15,11 +15,17 @@ describe LogStash::Settings do
15
15
  it "should raise an exception" do
16
16
  expect { subject.register(numeric_setting) }.to raise_error
17
17
  end
18
+ it "registered? should return true" do
19
+ expect( subject.registered?(numeric_setting_name)).to be_truthy
20
+ end
18
21
  end
19
22
  context "if setting hasn't been registered" do
20
23
  it "should not raise an exception" do
21
24
  expect { subject.register(numeric_setting) }.to_not raise_error
22
25
  end
26
+ it "registered? should return false" do
27
+ expect( subject.registered?(numeric_setting_name)).to be_falsey
28
+ end
23
29
  end
24
30
  end
25
31
  describe "#get_setting" do
@@ -150,23 +156,31 @@ describe LogStash::Settings do
150
156
 
151
157
  describe "#from_yaml" do
152
158
 
153
- context "env placeholders in flat logstash.yml" do
159
+ before :each do
160
+ LogStash::SETTINGS.set("keystore.file", File.join(File.dirname(__FILE__), "../../src/test/resources/logstash.keystore.with.default.pass"))
161
+ end
162
+
163
+ context "placeholders in flat logstash.yml" do
164
+
154
165
 
155
166
  after do
156
167
  ENV.delete('SOME_LOGSTASH_SPEC_ENV_VAR')
157
168
  ENV.delete('some.logstash.spec.env.var')
169
+ ENV.delete('a')
158
170
  end
159
171
 
160
172
  subject do
161
173
  settings = described_class.new
162
- settings.register(LogStash::Setting::String.new("interpolated", "missing"))
163
- settings.register(LogStash::Setting::String.new("with_dot", "missing"))
174
+ settings.register(LogStash::Setting::String.new("interpolated_env", "missing"))
175
+ settings.register(LogStash::Setting::String.new("with_dot_env", "missing"))
176
+ settings.register(LogStash::Setting::String.new("interpolated_store", "missing"))
164
177
  settings
165
178
  end
166
179
 
167
180
  let(:values) {{
168
- "interpolated" => "${SOME_LOGSTASH_SPEC_ENV_VAR}",
169
- "with_dot" => "${some.logstash.spec.env.var}"
181
+ "interpolated_env" => "${SOME_LOGSTASH_SPEC_ENV_VAR}",
182
+ "with_dot_env" => "${some.logstash.spec.env.var}",
183
+ "interpolated_store" => "${a}"
170
184
  }}
171
185
  let(:yaml_path) do
172
186
  p = Stud::Temporary.pathname
@@ -178,28 +192,37 @@ describe LogStash::Settings do
178
192
  p
179
193
  end
180
194
 
181
- it "can interpolate environment into settings" do
182
- expect(subject.get('interpolated')).to eq("missing")
183
- expect(subject.get('with_dot')).to eq("missing")
184
- ENV['SOME_LOGSTASH_SPEC_ENV_VAR'] = "correct_setting"
185
- ENV['some.logstash.spec.env.var'] = "correct_setting_for_dotted"
195
+ it "can interpolate into settings" do
196
+ expect(subject.get('interpolated_env')).to eq("missing")
197
+ expect(subject.get('with_dot_env')).to eq("missing")
198
+ expect(subject.get('interpolated_store')).to eq("missing")
199
+ ENV['SOME_LOGSTASH_SPEC_ENV_VAR'] = "correct_setting_env"
200
+ ENV['some.logstash.spec.env.var'] = "correct_setting_for_dotted_env"
201
+ ENV['a'] = "wrong_value" # the store should take precedence
186
202
  subject.from_yaml(yaml_path)
187
- expect(subject.get('interpolated')).to eq("correct_setting")
188
- expect(subject.get('with_dot')).to eq("correct_setting_for_dotted")
203
+ expect(subject.get('interpolated_env')).to eq("correct_setting_env")
204
+ expect(subject.get('with_dot_env')).to eq("correct_setting_for_dotted_env")
205
+ expect(subject.get('interpolated_store')).to eq("A")
189
206
  end
190
207
  end
191
208
  end
192
209
 
193
- context "env placeholders in nested logstash.yml" do
210
+ context "placeholders in nested logstash.yml" do
211
+
212
+ before :each do
213
+ LogStash::SETTINGS.set("keystore.file", File.join(File.dirname(__FILE__), "../../src/test/resources/logstash.keystore.with.default.pass"))
214
+ end
194
215
 
195
216
  before do
196
- ENV['lsspecdomain'] = "domain1"
197
- ENV['lsspecdomain2'] = "domain2"
217
+ ENV['lsspecdomain_env'] = "domain1"
218
+ ENV['lsspecdomain2_env'] = "domain2"
219
+ ENV['a'] = "wrong_value" # the store should take precedence
198
220
  end
199
221
 
200
222
  after do
201
- ENV.delete('lsspecdomain')
202
- ENV.delete('lsspecdomain2')
223
+ ENV.delete('lsspecdomain_env')
224
+ ENV.delete('lsspecdomain2_env')
225
+ ENV.delete('a')
203
226
  end
204
227
 
205
228
  subject do
@@ -210,10 +233,12 @@ describe LogStash::Settings do
210
233
  end
211
234
 
212
235
  let(:values) {{
213
- "host" => ["dev1.${lsspecdomain}", "dev2.${lsspecdomain}"],
236
+ "host" => ["dev1.${lsspecdomain_env}", "dev2.${lsspecdomain_env}", "dev3.${a}"],
214
237
  "modules" => [
215
- {"name" => "${lsspecdomain}", "testing" => "${lsspecdomain}"},
216
- {"name" => "${lsspecdomain2}", "testing" => "${lsspecdomain2}"}
238
+ {"name" => "${lsspecdomain_env}", "testing" => "${lsspecdomain_env}"},
239
+ {"name" => "${lsspecdomain2_env}", "testing" => "${lsspecdomain2_env}"},
240
+ {"name" => "${a}", "testing" => "${a}"},
241
+ {"name" => "${b}", "testing" => "${b}"}
217
242
  ]
218
243
  }}
219
244
  let(:yaml_path) do
@@ -230,10 +255,12 @@ describe LogStash::Settings do
230
255
  expect(subject.get('host')).to match_array([])
231
256
  expect(subject.get('modules')).to match_array([])
232
257
  subject.from_yaml(yaml_path)
233
- expect(subject.get('host')).to match_array(["dev1.domain1", "dev2.domain1"])
258
+ expect(subject.get('host')).to match_array(["dev1.domain1", "dev2.domain1", "dev3.A"])
234
259
  expect(subject.get('modules')).to match_array([
235
260
  {"name" => "domain1", "testing" => "domain1"},
236
- {"name" => "domain2", "testing" => "domain2"}
261
+ {"name" => "domain2", "testing" => "domain2"},
262
+ {"name" => "A", "testing" => "A"},
263
+ {"name" => "B", "testing" => "B"}
237
264
  ])
238
265
  end
239
266
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require "spec_helper"
4
- require "logstash/timestamp"
5
4
 
6
5
  describe LogStash::Timestamp do
7
6
  context "constructors" do
@@ -0,0 +1,69 @@
1
+ require "logstash/util/secretstore"
2
+ require "logstash/settings"
3
+
4
+ describe LogStash::Util::SecretStore do
5
+
6
+ subject {LogStash::Util::SecretStore}
7
+
8
+ describe "with missing keystore" do
9
+ before :each do
10
+ LogStash::SETTINGS.set("keystore.file", File.join(File.dirname(__FILE__), "nothing_here"))
11
+ end
12
+
13
+ it "should be not exist" do
14
+ expect(subject.exists?).to be_falsy
15
+ expect(subject.get_if_exists).to be_nil
16
+ end
17
+ end
18
+
19
+ describe "with implicit password keystore" do
20
+ before :each do
21
+ LogStash::SETTINGS.set("keystore.file", File.join(File.dirname(__FILE__), "../../../src/test/resources/logstash.keystore.with.default.pass"))
22
+ end
23
+
24
+ it "should be readable" do
25
+ expect(subject.get_if_exists.list).to include(subject.get_store_id("keystore.seed"))
26
+ end
27
+ end
28
+
29
+ describe "with explicit password keystore" do
30
+ before :each do
31
+ LogStash::SETTINGS.set("keystore.file", File.join(File.dirname(__FILE__), "../../../src/test/resources/logstash.keystore.with.defined.pass"))
32
+ end
33
+
34
+ describe "and correct password" do
35
+ before do
36
+ ENV['LOGSTASH_KEYSTORE_PASS'] = "mypassword"
37
+ end
38
+
39
+ after do
40
+ ENV.delete('LOGSTASH_KEYSTORE_PASS')
41
+ end
42
+
43
+ it "should be readable" do
44
+ expect(subject.get_if_exists.list).to include(subject.get_store_id("keystore.seed"))
45
+ end
46
+ end
47
+
48
+ describe "and wrong password" do
49
+ before do
50
+ ENV['LOGSTASH_KEYSTORE_PASS'] = "not_the_correct_password"
51
+ end
52
+
53
+ after do
54
+ ENV.delete('LOGSTASH_KEYSTORE_PASS')
55
+ end
56
+
57
+ it "should be not readable" do
58
+ expect {subject.get_if_exists}.to raise_error.with_message(/Can not access Logstash keystore/)
59
+ end
60
+ end
61
+
62
+ describe "and missing password" do
63
+ it "should be not readable" do
64
+ expect {subject.get_if_exists}.to raise_error.with_message(/Could not determine keystore password/)
65
+ end
66
+ end
67
+ end
68
+
69
+ end
@@ -13,6 +13,23 @@ module LogStash
13
13
  # noop
14
14
  end
15
15
  end
16
+
17
+ class DummyBlockingInput < LogStash::Inputs::Base
18
+ config_name "dummyblockinginput"
19
+ milestone 2
20
+
21
+ def register
22
+ @latch = java.util.concurrent.CountDownLatch.new(1)
23
+ end
24
+
25
+ def run(_)
26
+ @latch.await
27
+ end
28
+
29
+ def stop
30
+ @latch.count_down
31
+ end
32
+ end
16
33
  end
17
34
 
18
35
  module Filters
@@ -39,13 +56,17 @@ module LogStash
39
56
  super
40
57
  @num_closes = 0
41
58
  @events = []
59
+ @mutex = Mutex.new
42
60
  end
43
61
 
44
62
  def register
45
63
  end
46
64
 
47
65
  def receive(event)
66
+ @mutex.lock
48
67
  @events << event
68
+ ensure
69
+ @mutex.unlock
49
70
  end
50
71
 
51
72
  def close
@@ -1,6 +1,6 @@
1
1
  ---
2
- logstash: 6.1.4
3
- logstash-core: 6.1.4
2
+ logstash: 6.2.0
3
+ logstash-core: 6.2.0
4
4
  logstash-core-plugin-api: 2.1.16
5
5
 
6
6
  # jruby must reference a *released* version of jruby which can be downloaded from the official download url
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.4
4
+ version: 6.2.0
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-14 00:00:00.000000000 Z
11
+ date: 2018-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -260,34 +260,6 @@ dependencies:
260
260
  - - "~>"
261
261
  - !ruby/object:Gem::Version
262
262
  version: 0.4.4
263
- - !ruby/object:Gem::Dependency
264
- requirement: !ruby/object:Gem::Requirement
265
- requirements:
266
- - - ">="
267
- - !ruby/object:Gem::Version
268
- version: '0'
269
- name: jar-dependencies
270
- prerelease: false
271
- type: :runtime
272
- version_requirements: !ruby/object:Gem::Requirement
273
- requirements:
274
- - - ">="
275
- - !ruby/object:Gem::Version
276
- version: '0'
277
- - !ruby/object:Gem::Dependency
278
- requirement: !ruby/object:Gem::Requirement
279
- requirements:
280
- - - "~>"
281
- - !ruby/object:Gem::Version
282
- version: 3.3.9
283
- name: ruby-maven
284
- prerelease: false
285
- type: :runtime
286
- version_requirements: !ruby/object:Gem::Requirement
287
- requirements:
288
- - - "~>"
289
- - !ruby/object:Gem::Version
290
- version: 3.3.9
291
263
  - !ruby/object:Gem::Dependency
292
264
  requirement: !ruby/object:Gem::Requirement
293
265
  requirements:
@@ -336,12 +308,9 @@ executables: []
336
308
  extensions: []
337
309
  extra_rdoc_files: []
338
310
  files:
339
- - gemspec_jars.rb
340
311
  - lib/logstash-core.rb
341
- - lib/logstash-core/logstash-core.jar
342
312
  - lib/logstash-core/logstash-core.rb
343
313
  - lib/logstash-core/version.rb
344
- - lib/logstash-core_jars.rb
345
314
  - lib/logstash/agent.rb
346
315
  - lib/logstash/api/app_helpers.rb
347
316
  - lib/logstash/api/command_factory.rb
@@ -495,6 +464,7 @@ files:
495
464
  - lib/logstash/util/prctl.rb
496
465
  - lib/logstash/util/retryable.rb
497
466
  - lib/logstash/util/safe_uri.rb
467
+ - lib/logstash/util/secretstore.rb
498
468
  - lib/logstash/util/settings_helper.rb
499
469
  - lib/logstash/util/socket_peer.rb
500
470
  - lib/logstash/util/substitution_variables.rb
@@ -606,6 +576,7 @@ files:
606
576
  - spec/logstash/util/java_version_spec.rb
607
577
  - spec/logstash/util/plugin_version_spec.rb
608
578
  - spec/logstash/util/safe_uri_spec.rb
579
+ - spec/logstash/util/secretstore_spec.rb
609
580
  - spec/logstash/util/time_value_spec.rb
610
581
  - spec/logstash/util/unicode_trimmer_spec.rb
611
582
  - spec/logstash/util/wrapped_acked_queue_spec.rb
@@ -638,15 +609,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
638
609
  - - ">="
639
610
  - !ruby/object:Gem::Version
640
611
  version: '0'
641
- requirements:
642
- - jar org.apache.logging.log4j:log4j-slf4j-impl, 2.6.2
643
- - jar org.apache.logging.log4j:log4j-api, 2.6.2
644
- - jar org.apache.logging.log4j:log4j-core, 2.6.2
645
- - jar com.fasterxml.jackson.core:jackson-core, 2.9.1
646
- - jar com.fasterxml.jackson.core:jackson-databind, 2.9.1
647
- - jar com.fasterxml.jackson.core:jackson-annotations, 2.9.1
648
- - jar org.codehaus.janino:janino, 3.0.7
649
- - jar com.fasterxml.jackson.dataformat:jackson-dataformat-cbor, 2.9.1
612
+ requirements: []
650
613
  rubyforge_project:
651
614
  rubygems_version: 2.6.13
652
615
  signing_key:
@@ -751,6 +714,7 @@ test_files:
751
714
  - spec/logstash/util/java_version_spec.rb
752
715
  - spec/logstash/util/plugin_version_spec.rb
753
716
  - spec/logstash/util/safe_uri_spec.rb
717
+ - spec/logstash/util/secretstore_spec.rb
754
718
  - spec/logstash/util/time_value_spec.rb
755
719
  - spec/logstash/util/unicode_trimmer_spec.rb
756
720
  - spec/logstash/util/wrapped_acked_queue_spec.rb
@@ -1,12 +0,0 @@
1
- # This file is generated by Gradle as part of the build process. It extracts the build.gradle
2
- # runtime dependencies to generate this gemspec dependencies file to be eval'ed by the gemspec
3
- # for the jar-dependencies requirements.
4
-
5
- gem.requirements << "jar org.apache.logging.log4j:log4j-slf4j-impl, 2.6.2"
6
- gem.requirements << "jar org.apache.logging.log4j:log4j-api, 2.6.2"
7
- gem.requirements << "jar org.apache.logging.log4j:log4j-core, 2.6.2"
8
- gem.requirements << "jar com.fasterxml.jackson.core:jackson-core, 2.9.1"
9
- gem.requirements << "jar com.fasterxml.jackson.core:jackson-databind, 2.9.1"
10
- gem.requirements << "jar com.fasterxml.jackson.core:jackson-annotations, 2.9.1"
11
- gem.requirements << "jar org.codehaus.janino:janino, 3.0.7"
12
- gem.requirements << "jar com.fasterxml.jackson.dataformat:jackson-dataformat-cbor, 2.9.1"