logstash-core 7.0.0.beta1-java → 7.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 650eff422fce2ce58c826a22c759238b5cb14bb407232b3cb0ffe2119635df29
4
- data.tar.gz: 44a83cccdc93c56fcc4952746675702b7593e0f494b167efcfc4fe002566dfb6
3
+ metadata.gz: 28e722ae2fb8a55597537a5a40e0fccb6b2510ac485aa180f2e7c67cb3ebecef
4
+ data.tar.gz: e38a8c79b5dfc729c447906562985700cb85970532331d473de8ff569707b10b
5
5
  SHA512:
6
- metadata.gz: 94c5e143d649f75006330dfc9f77d3551d011aabef1e18017cb0eff8f96ae16d6690b5487acbabec3e9adae5eb0d3a4cb8bfb974a174cbb8d4073f659ab821cf
7
- data.tar.gz: 1500544458de19cb215a0f45e6b83a00b4d8ef0b05f951536a080f2fad359502eaf847792b20719e1781727caddc11349d7c504c82d0cfe47aa5ff8e158f66e8
6
+ metadata.gz: 35c4f0f489b48d2dece09484bf15ac04104ceb5c7306c898cb4a8dec3de3c5f1376b01f1264c1dc7a6b53712e7016d23c2801d8242308a7aacf41edd9a9a6c90
7
+ data.tar.gz: 81b744620d9d94db74554f9f896a22658c4a4907671d73afcc137b77e6828cfad68e07d3b88ffd2bd98b5536ced0853db00319fca41c0f247347be89d696c0b4
@@ -36,9 +36,10 @@ class LogStash::Agent
36
36
 
37
37
  # Mutex to synchonize in the exclusive method
38
38
  # Initial usage for the Ruby pipeline initialization which is not thread safe
39
- @exclusive_lock = Mutex.new
40
39
  @webserver_control_lock = Mutex.new
41
40
 
41
+ @convergence_lock = Mutex.new
42
+
42
43
  # Special bus object for inter-pipelines communications. Used by the `pipeline` input/output
43
44
  @pipeline_bus = org.logstash.plugins.pipeline.PipelineBus.new
44
45
 
@@ -86,10 +87,6 @@ class LogStash::Agent
86
87
  @running = Concurrent::AtomicBoolean.new(false)
87
88
  end
88
89
 
89
- def exclusive(&block)
90
- @exclusive_lock.synchronize { block.call }
91
- end
92
-
93
90
  def execute
94
91
  @thread = Thread.current # this var is implicitly used by Stud.stop?
95
92
  logger.debug("Starting agent")
@@ -159,12 +156,7 @@ class LogStash::Agent
159
156
  end
160
157
  end
161
158
 
162
- # We Lock any access on the pipelines, since the actions will modify the
163
- # content of it.
164
- converge_result = nil
165
-
166
- pipeline_actions = resolve_actions(results.response)
167
- converge_result = converge_state(pipeline_actions)
159
+ converge_result = resolve_actions_and_converge_state(results.response)
168
160
  update_metrics(converge_result)
169
161
 
170
162
  logger.info(
@@ -288,6 +280,15 @@ class LogStash::Agent
288
280
  @running.make_true
289
281
  end
290
282
 
283
+ # @param pipeline_configs [Array<Config::PipelineConfig>]
284
+ # @return [ConvergeResult]
285
+ def resolve_actions_and_converge_state(pipeline_configs)
286
+ @convergence_lock.synchronize do
287
+ pipeline_actions = resolve_actions(pipeline_configs)
288
+ converge_state(pipeline_actions)
289
+ end
290
+ end
291
+
291
292
  # We depends on a series of task derived from the internal state and what
292
293
  # need to be run, theses actions are applied to the current pipelines to converge to
293
294
  # the desired state.
@@ -300,6 +301,7 @@ class LogStash::Agent
300
301
  #
301
302
  def converge_state(pipeline_actions)
302
303
  logger.debug("Converging pipelines state", :actions_count => pipeline_actions.size)
304
+ fail("Illegal access to `LogStash::Agent#converge_state()` without exclusive lock at #{caller[1]}") unless @convergence_lock.owned?
303
305
 
304
306
  converge_result = LogStash::ConvergeResult.new(pipeline_actions.size)
305
307
 
@@ -348,6 +350,7 @@ class LogStash::Agent
348
350
  end
349
351
 
350
352
  def resolve_actions(pipeline_configs)
353
+ fail("Illegal access to `LogStash::Agent#resolve_actions()` without exclusive lock at #{caller[1]}") unless @convergence_lock.owned?
351
354
  @state_resolver.resolve(@pipelines_registry, pipeline_configs)
352
355
  end
353
356
 
@@ -415,8 +418,7 @@ class LogStash::Agent
415
418
  # In this context I could just call shutdown, but I've decided to
416
419
  # use the stop action implementation for that so we have the same code.
417
420
  # This also give us some context into why a shutdown is failing
418
- pipeline_actions = resolve_actions([]) # We stop all the pipeline, so we converge to a empty state
419
- converge_state(pipeline_actions)
421
+ resolve_actions_and_converge_state([]) # We stop all the pipeline, so we converge to a empty state
420
422
  end
421
423
 
422
424
 
@@ -115,7 +115,7 @@ module LogStashCompilerLSCLGrammar; module LogStash; module Compiler; module LSC
115
115
  elsif existing.kind_of?(::Array)
116
116
  hash[k] = existing.push(*v)
117
117
  else
118
- hash[k] = existing + v
118
+ hash[k] = [existing, v] unless v == existing
119
119
  end
120
120
  hash
121
121
  end
@@ -32,22 +32,11 @@ module LogStash module PipelineAction
32
32
  # The execute assume that the thread safety access of the pipeline
33
33
  # is managed by the caller.
34
34
  def execute(agent, pipelines_registry)
35
- new_pipeline =
36
- if @pipeline_config.settings.get_value("pipeline.java_execution")
37
- LogStash::JavaPipeline.new(@pipeline_config, @metric, agent)
38
- else
39
- agent.exclusive do
40
- # The Ruby pipeline initialization is not thread safe because of the module level
41
- # shared state in LogsStash::Config::AST. When using multiple pipelines this gets
42
- # executed simultaneously in different threads and we need to synchronize this initialization.
43
- LogStash::Pipeline.new(@pipeline_config, @metric, agent)
44
- end
45
- end
46
-
35
+ pipeline_class = @pipeline_config.settings.get_value("pipeline.java_execution") ? LogStash::JavaPipeline : LogStash::Pipeline
36
+ new_pipeline = pipeline_class.new(@pipeline_config, @metric, agent)
47
37
  success = pipelines_registry.create_pipeline(pipeline_id, new_pipeline) do
48
38
  new_pipeline.start # block until the pipeline is correctly started or crashed
49
39
  end
50
-
51
40
  LogStash::ConvergeResult::ActionResult.create(self, success)
52
41
  end
53
42
 
@@ -31,18 +31,10 @@ module LogStash module PipelineAction
31
31
  return LogStash::ConvergeResult::FailedAction.new("Cannot reload pipeline, because the existing pipeline is not reloadable")
32
32
  end
33
33
 
34
+ java_exec = @pipeline_config.settings.get_value("pipeline.java_execution")
35
+
34
36
  begin
35
- pipeline_validator =
36
- if @pipeline_config.settings.get_value("pipeline.java_execution")
37
- LogStash::JavaBasePipeline.new(@pipeline_config, nil, logger, nil)
38
- else
39
- agent.exclusive do
40
- # The Ruby pipeline initialization is not thread safe because of the module level
41
- # shared state in LogsStash::Config::AST. When using multiple pipelines this gets
42
- # executed simultaneously in different threads and we need to synchronize this initialization.
43
- LogStash::BasePipeline.new(@pipeline_config)
44
- end
45
- end
37
+ pipeline_validator = java_exec ? LogStash::JavaBasePipeline.new(@pipeline_config, nil, logger, nil) : LogStash::BasePipeline.new(@pipeline_config)
46
38
  rescue => e
47
39
  return LogStash::ConvergeResult::FailedAction.from_exception(e)
48
40
  end
@@ -62,18 +54,7 @@ module LogStash module PipelineAction
62
54
  old_pipeline.thread.join
63
55
 
64
56
  # Then create a new pipeline
65
- new_pipeline =
66
- if @pipeline_config.settings.get_value("pipeline.java_execution")
67
- LogStash::JavaPipeline.new(@pipeline_config, @metric, agent)
68
- else
69
- agent.exclusive do
70
- # The Ruby pipeline initialization is not thread safe because of the module level
71
- # shared state in LogsStash::Config::AST. When using multiple pipelines this gets
72
- # executed simultaneously in different threads and we need to synchronize this initialization.
73
- LogStash::Pipeline.new(@pipeline_config, @metric, agent)
74
- end
75
- end
76
-
57
+ new_pipeline = java_exec ? LogStash::JavaPipeline.new(@pipeline_config, @metric, agent) : LogStash::Pipeline.new(@pipeline_config, @metric, agent)
77
58
  success = new_pipeline.start # block until the pipeline is correctly started or crashed
78
59
 
79
60
  # return success and new_pipeline to registry reload_pipeline
@@ -369,6 +369,8 @@ class LogStash::Runner < Clamp::StrictCommand
369
369
 
370
370
  @agent.shutdown
371
371
 
372
+ logger.info("Logstash shut down.")
373
+
372
374
  # flush any outstanding log messages during shutdown
373
375
  org.apache.logging.log4j.LogManager.shutdown
374
376
 
@@ -586,6 +586,30 @@ module LogStash
586
586
  coerce(value)
587
587
  end
588
588
  end
589
+
590
+ ##
591
+ # Instances of `DeprecatedSetting` can be registered, but will fail with helpful guidance when encountering any
592
+ # configuration that attempts to explicitly set the value. They should be used in the Major version immediately
593
+ # following a deprecation to assist users who are porting forward configurations.
594
+ class DeprecatedSetting < Setting
595
+ def initialize(name, guidance='please remove the setting from your configuration and try again.')
596
+ super(name, Object)
597
+ @guidance = guidance
598
+ end
599
+
600
+ def set(value)
601
+ fail(ArgumentError, "The setting `#{name}` has been deprecated and removed from Logstash; #{@guidance}")
602
+ end
603
+ end
604
+
605
+ # Useful when a setting has been renamed but otherwise is semantically identical
606
+ class DeprecatedAndRenamed < DeprecatedSetting
607
+ attr_reader :new_name
608
+ def initialize(name, new_name)
609
+ super(name, "please update your configuration to use `#{new_name}` instead.")
610
+ @new_name = new_name
611
+ end
612
+ end
589
613
  end
590
614
 
591
615
 
@@ -419,6 +419,7 @@ describe LogStash::Config::Mixin do
419
419
  end
420
420
 
421
421
  it "should use the value in the variable" do
422
+ skip("This test fails on Windows, tracked in https://github.com/elastic/logstash/issues/10454")
422
423
  expect(subject.oneString).to(be == "fancy")
423
424
  expect(subject.oneBoolean).to(be_truthy)
424
425
  expect(subject.oneArray).to(be == [ "first array value", "fancy" ])
@@ -322,4 +322,18 @@ describe LogStash::Filters::NOOP do
322
322
  end
323
323
 
324
324
  end
325
+
326
+ describe "when metrics are disabled" do
327
+ describe "An error should not be raised, and the event should be processed" do
328
+ config <<-CONFIG
329
+ filter {
330
+ noop { enable_metric => false }
331
+ }
332
+ CONFIG
333
+
334
+ sample_one("type" => "noop", "tags" => {"blackhole" => "go"}) do
335
+ expect(subject.get("[tags][blackhole]")).to eq("go")
336
+ end
337
+ end
338
+ end
325
339
  end
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+ require 'logstash/settings'
4
+
5
+ describe LogStash::Setting::DeprecatedAndRenamed do
6
+ subject(:setting) { described_class.new("option.deprecated", "option.current") }
7
+ let(:value) { Object.new }
8
+
9
+ describe '#set' do
10
+ it 'fails with deprecation runtime error and helpful guidance' do
11
+ expect { setting.set(value) }.to raise_exception do |exception|
12
+ expect(exception).to be_a_kind_of(ArgumentError)
13
+ expect(exception.message).to match(/deprecated and removed/)
14
+ expect(exception.message).to include("option.deprecated")
15
+ expect(exception.message).to include("option.current")
16
+ end
17
+ end
18
+ end
19
+ end
@@ -7,8 +7,8 @@ logstash-core-plugin-api: 2.1.16
7
7
  # jruby must reference a *released* version of jruby which can be downloaded from the official download url
8
8
  # *and* for which jars artifacts are published for compile-time
9
9
  jruby:
10
- version: 9.2.5.0
11
- sha1: c78526ce98b1b4273d11989246cb9bf224ce9712
10
+ version: 9.2.6.0
11
+ sha1: 3c13ec3966f6cc44966f3978c96325b9e56174f1
12
12
 
13
13
  # jruby-runtime-override, if specified, will override the jruby version installed in vendor/jruby for logstash runtime only,
14
14
  # not for the compile-time jars
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: 7.0.0.beta1
4
+ version: 7.0.0
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-13 00:00:00.000000000 Z
11
+ date: 2019-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -535,6 +535,7 @@ files:
535
535
  - spec/logstash/setting_spec.rb
536
536
  - spec/logstash/settings/array_coercible_spec.rb
537
537
  - spec/logstash/settings/bytes_spec.rb
538
+ - spec/logstash/settings/deprecated_and_renamed_spec.rb
538
539
  - spec/logstash/settings/integer_spec.rb
539
540
  - spec/logstash/settings/modules_spec.rb
540
541
  - spec/logstash/settings/numeric_spec.rb
@@ -585,9 +586,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
585
586
  version: '0'
586
587
  required_rubygems_version: !ruby/object:Gem::Requirement
587
588
  requirements:
588
- - - ">"
589
+ - - ">="
589
590
  - !ruby/object:Gem::Version
590
- version: 1.3.1
591
+ version: '0'
591
592
  requirements: []
592
593
  rubyforge_project:
593
594
  rubygems_version: 2.7.6
@@ -675,6 +676,7 @@ test_files:
675
676
  - spec/logstash/setting_spec.rb
676
677
  - spec/logstash/settings/array_coercible_spec.rb
677
678
  - spec/logstash/settings/bytes_spec.rb
679
+ - spec/logstash/settings/deprecated_and_renamed_spec.rb
678
680
  - spec/logstash/settings/integer_spec.rb
679
681
  - spec/logstash/settings/modules_spec.rb
680
682
  - spec/logstash/settings/numeric_spec.rb