logstash-core 6.0.0.beta1-java → 6.0.0.beta2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash-core/logstash-core.jar +0 -0
- data/lib/logstash-core/version.rb +1 -1
- data/lib/logstash/agent.rb +0 -16
- data/lib/logstash/compiler/lscl.rb +2 -53
- data/lib/logstash/compiler/lscl/helpers.rb +55 -0
- data/lib/logstash/config/config_ast.rb +6 -3
- data/lib/logstash/config/modules_common.rb +4 -1
- data/lib/logstash/elasticsearch_client.rb +4 -1
- data/lib/logstash/environment.rb +8 -2
- data/lib/logstash/filter_delegator.rb +11 -6
- data/lib/logstash/instrument/collector.rb +7 -5
- data/lib/logstash/instrument/metric_store.rb +6 -9
- data/lib/logstash/instrument/namespaced_metric.rb +4 -0
- data/lib/logstash/instrument/namespaced_null_metric.rb +4 -0
- data/lib/logstash/instrument/null_metric.rb +10 -0
- data/lib/logstash/instrument/wrapped_write_client.rb +33 -24
- data/lib/logstash/modules/kibana_client.rb +5 -3
- data/lib/logstash/modules/kibana_config.rb +1 -4
- data/lib/logstash/modules/scaffold.rb +2 -0
- data/lib/logstash/modules/settings_merger.rb +52 -4
- data/lib/logstash/output_delegator.rb +7 -5
- data/lib/logstash/pipeline.rb +37 -14
- data/lib/logstash/pipeline_settings.rb +2 -0
- data/lib/logstash/runner.rb +14 -2
- data/lib/logstash/settings.rb +26 -0
- data/lib/logstash/util/cloud_setting_auth.rb +29 -0
- data/lib/logstash/util/cloud_setting_id.rb +41 -0
- data/lib/logstash/util/modules_setting_array.rb +28 -0
- data/lib/logstash/util/wrapped_acked_queue.rb +5 -6
- data/lib/logstash/util/wrapped_synchronous_queue.rb +14 -9
- data/lib/logstash/version.rb +1 -1
- data/locales/en.yml +16 -0
- data/spec/logstash/agent/converge_spec.rb +6 -7
- data/spec/logstash/config/source/multi_local_spec.rb +11 -0
- data/spec/logstash/filter_delegator_spec.rb +20 -8
- data/spec/logstash/legacy_ruby_event_spec.rb +4 -4
- data/spec/logstash/modules/scaffold_spec.rb +2 -7
- data/spec/logstash/modules/settings_merger_spec.rb +111 -0
- data/spec/logstash/output_delegator_spec.rb +15 -5
- data/spec/logstash/pipeline_spec.rb +39 -7
- data/spec/logstash/runner_spec.rb +4 -1
- data/spec/logstash/settings/modules_spec.rb +115 -0
- metadata +10 -2
@@ -41,6 +41,8 @@ class DummyCodec < LogStash::Codecs::Base
|
|
41
41
|
config_name "dummycodec"
|
42
42
|
milestone 2
|
43
43
|
|
44
|
+
config :format, :validate => :string
|
45
|
+
|
44
46
|
def decode(data)
|
45
47
|
data
|
46
48
|
end
|
@@ -93,11 +95,21 @@ class DummyFlushingFilter < LogStash::Filters::Base
|
|
93
95
|
true
|
94
96
|
end
|
95
97
|
def flush(options)
|
96
|
-
|
98
|
+
[::LogStash::Event.new("message" => "dummy_flush")]
|
97
99
|
end
|
98
100
|
def close() end
|
99
101
|
end
|
100
102
|
|
103
|
+
class DummyFlushingFilterPeriodic < DummyFlushingFilter
|
104
|
+
config_name "dummyflushingfilterperiodic"
|
105
|
+
|
106
|
+
def flush(options)
|
107
|
+
# Don't generate events on the shutdown flush to make sure we actually test the
|
108
|
+
# periodic flush.
|
109
|
+
options[:final] ? [] : [::LogStash::Event.new("message" => "dummy_flush")]
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
101
113
|
class TestPipeline < LogStash::Pipeline
|
102
114
|
attr_reader :outputs, :settings
|
103
115
|
end
|
@@ -108,7 +120,7 @@ describe LogStash::Pipeline do
|
|
108
120
|
let(:override_thread_count) { 42 }
|
109
121
|
let(:dead_letter_queue_enabled) { false }
|
110
122
|
let(:dead_letter_queue_path) { }
|
111
|
-
let(:pipeline_settings_obj) { LogStash::SETTINGS }
|
123
|
+
let(:pipeline_settings_obj) { LogStash::SETTINGS.clone }
|
112
124
|
let(:pipeline_settings) { {} }
|
113
125
|
let(:max_retry) {10} #times
|
114
126
|
let(:timeout) {120} #seconds
|
@@ -124,10 +136,6 @@ describe LogStash::Pipeline do
|
|
124
136
|
pipeline_settings.each {|k, v| pipeline_settings_obj.set(k, v) }
|
125
137
|
end
|
126
138
|
|
127
|
-
after :each do
|
128
|
-
pipeline_settings_obj.reset
|
129
|
-
end
|
130
|
-
|
131
139
|
describe "#ephemeral_id" do
|
132
140
|
it "creates an ephemeral_id at creation time" do
|
133
141
|
pipeline = mock_pipeline_from_string("input { generator { count => 1 } } output { null {} }")
|
@@ -355,6 +363,30 @@ describe LogStash::Pipeline do
|
|
355
363
|
end
|
356
364
|
end
|
357
365
|
|
366
|
+
context "with no explicit ids declared" do
|
367
|
+
before(:each) do
|
368
|
+
allow(LogStash::Plugin).to receive(:lookup).with("input", "dummyinput").and_return(DummyInput)
|
369
|
+
allow(LogStash::Plugin).to receive(:lookup).with("codec", "plain").and_return(DummyCodec)
|
370
|
+
allow(LogStash::Plugin).to receive(:lookup).with("filter", "dummyfilter").and_return(DummyFilter)
|
371
|
+
allow(LogStash::Plugin).to receive(:lookup).with("output", "dummyoutput").and_return(::LogStash::Outputs::DummyOutput)
|
372
|
+
end
|
373
|
+
|
374
|
+
let(:config) { "input { dummyinput { codec => plain { format => 'something' } } } filter { dummyfilter {} } output { dummyoutput {} }"}
|
375
|
+
let(:pipeline) { mock_pipeline_from_string(config) }
|
376
|
+
|
377
|
+
after do
|
378
|
+
# If you don't start/stop the pipeline it won't release the queue lock and will
|
379
|
+
# cause the suite to fail :(
|
380
|
+
pipeline.close
|
381
|
+
end
|
382
|
+
|
383
|
+
it "should use LIR provided IDs" do
|
384
|
+
expect(pipeline.inputs.first.id).to eq(pipeline.lir.input_plugin_vertices.first.id)
|
385
|
+
expect(pipeline.filters.first.id).to eq(pipeline.lir.filter_plugin_vertices.first.id)
|
386
|
+
expect(pipeline.outputs.first.id).to eq(pipeline.lir.output_plugin_vertices.first.id)
|
387
|
+
end
|
388
|
+
end
|
389
|
+
|
358
390
|
context "compiled flush function" do
|
359
391
|
describe "flusher thread" do
|
360
392
|
before(:each) do
|
@@ -627,7 +659,7 @@ describe LogStash::Pipeline do
|
|
627
659
|
before do
|
628
660
|
allow(::LogStash::Outputs::DummyOutput).to receive(:new).with(any_args).and_return(output)
|
629
661
|
allow(LogStash::Plugin).to receive(:lookup).with("input", "dummy_input").and_return(DummyInput)
|
630
|
-
allow(LogStash::Plugin).to receive(:lookup).with("filter", "dummy_flushing_filter").and_return(
|
662
|
+
allow(LogStash::Plugin).to receive(:lookup).with("filter", "dummy_flushing_filter").and_return(DummyFlushingFilterPeriodic)
|
631
663
|
allow(LogStash::Plugin).to receive(:lookup).with("output", "dummy_output").and_return(::LogStash::Outputs::DummyOutput)
|
632
664
|
allow(LogStash::Plugin).to receive(:lookup).with("codec", "plain").and_return(LogStash::Codecs::Plain)
|
633
665
|
end
|
@@ -294,6 +294,9 @@ describe LogStash::Runner do
|
|
294
294
|
end
|
295
295
|
|
296
296
|
describe "config.debug" do
|
297
|
+
after(:each) do
|
298
|
+
LogStash::SETTINGS.set("config.debug", false)
|
299
|
+
end
|
297
300
|
it "should set 'config.debug' to false by default" do
|
298
301
|
expect(LogStash::Agent).to receive(:new) do |settings|
|
299
302
|
expect(settings.get("config.debug")).to eq(false)
|
@@ -340,7 +343,7 @@ describe LogStash::Runner do
|
|
340
343
|
end
|
341
344
|
|
342
345
|
describe "--modules" do
|
343
|
-
let(:args) { ["--modules", module_string] }
|
346
|
+
let(:args) { ["--modules", module_string, "--setup"] }
|
344
347
|
|
345
348
|
context "with an available module specified but no connection to elasticsearch" do
|
346
349
|
let(:module_string) { "tester" }
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "spec_helper"
|
3
|
+
require "logstash/settings"
|
4
|
+
require "logstash/util/cloud_setting_id"
|
5
|
+
require "logstash/util/cloud_setting_auth"
|
6
|
+
require "logstash/util/modules_setting_array"
|
7
|
+
|
8
|
+
describe LogStash::Setting::Modules do
|
9
|
+
describe "Modules.Cli" do
|
10
|
+
subject { described_class.new("mycloudid", LogStash::Util::ModulesSettingArray, []) }
|
11
|
+
context "when given an array of hashes that contains a password key" do
|
12
|
+
it "should convert password Strings to Password" do
|
13
|
+
source = [{"var.kibana.password" => "some_secret"}]
|
14
|
+
setting = subject.set(source)
|
15
|
+
expect(setting).to be_a(Array)
|
16
|
+
expect(setting.__class__).to eq(LogStash::Util::ModulesSettingArray)
|
17
|
+
expect(setting.first.fetch("var.kibana.password")).to be_a(LogStash::Util::Password)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "Cloud.Id" do
|
23
|
+
subject { described_class.new("mycloudid", LogStash::Util::CloudSettingId) }
|
24
|
+
context "when given a string which is not a cloud id" do
|
25
|
+
it "should raise an exception" do
|
26
|
+
expect { subject.set("foobarbaz") }.to raise_error(ArgumentError, /Cloud Id does not decode/)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context "when given a string which is empty" do
|
31
|
+
it "should raise an exception" do
|
32
|
+
expect { subject.set("") }.to raise_error(ArgumentError, /Cloud Id does not decode/)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context "when given a string which is has environment prefix only" do
|
37
|
+
it "should raise an exception" do
|
38
|
+
expect { subject.set("testing:") }.to raise_error(ArgumentError, /Cloud Id does not decode/)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "when given a badly formatted encoded id" do
|
43
|
+
it "should not raise an error" do
|
44
|
+
encoded = Base64.urlsafe_encode64("foo$$bal")
|
45
|
+
expect { subject.set(encoded) }.to raise_error(ArgumentError, /Cloud Id, after decoding, is invalid. Format: '<part1>\$<part2>\$<part3>'/)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context "when given a nil" do
|
50
|
+
it "should not raise an error" do
|
51
|
+
expect { subject.set(nil) }.to_not raise_error
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "when given a string which is an unlabelled cloud id" do
|
56
|
+
it "should set a LogStash::Util::CloudId instance" do
|
57
|
+
expect { subject.set("dXMtZWFzdC0xLmF3cy5mb3VuZC5pbyRub3RhcmVhbCRpZGVudGlmaWVy") }.to_not raise_error
|
58
|
+
expect(subject.value.elasticsearch_host).to eq("notareal.us-east-1.aws.found.io:443")
|
59
|
+
expect(subject.value.kibana_host).to eq("identifier.us-east-1.aws.found.io:443")
|
60
|
+
expect(subject.value.label).to eq("")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context "when given a string which is a labelled cloud id" do
|
65
|
+
it "should set a LogStash::Util::CloudId instance" do
|
66
|
+
expect { subject.set("staging:dXMtZWFzdC0xLmF3cy5mb3VuZC5pbyRub3RhcmVhbCRpZGVudGlmaWVy") }.to_not raise_error
|
67
|
+
expect(subject.value.elasticsearch_host).to eq("notareal.us-east-1.aws.found.io:443")
|
68
|
+
expect(subject.value.kibana_host).to eq("identifier.us-east-1.aws.found.io:443")
|
69
|
+
expect(subject.value.label).to eq("staging")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe "Cloud.Auth" do
|
75
|
+
subject { described_class.new("mycloudauth", LogStash::Util::CloudSettingAuth) }
|
76
|
+
context "when given a string without a separator or a password" do
|
77
|
+
it "should raise an exception" do
|
78
|
+
expect { subject.set("foobarbaz") }.to raise_error(ArgumentError, /Cloud Auth username and password format should be/)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context "when given a string without a password" do
|
83
|
+
it "should raise an exception" do
|
84
|
+
expect { subject.set("foo:") }.to raise_error(ArgumentError, /Cloud Auth username and password format should be/)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
context "when given a string without a username" do
|
89
|
+
it "should raise an exception" do
|
90
|
+
expect { subject.set(":bar") }.to raise_error(ArgumentError, /Cloud Auth username and password format should be/)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
context "when given a string which is empty" do
|
95
|
+
it "should raise an exception" do
|
96
|
+
expect { subject.set("") }.to raise_error(ArgumentError, /Cloud Auth username and password format should be/)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
context "when given a nil" do
|
101
|
+
it "should not raise an error" do
|
102
|
+
expect { subject.set(nil) }.to_not raise_error
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
context "when given a string which is a cloud auth" do
|
107
|
+
it "should set the string" do
|
108
|
+
expect { subject.set("frodo:baggins") }.to_not raise_error
|
109
|
+
expect(subject.value.username).to eq("frodo")
|
110
|
+
expect(subject.value.password.value).to eq("baggins")
|
111
|
+
expect(subject.value.to_s).to eq("frodo:<password>")
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
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.0.0.
|
4
|
+
version: 6.0.0.beta2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -369,6 +369,7 @@ files:
|
|
369
369
|
- lib/logstash/codecs/base.rb
|
370
370
|
- lib/logstash/compiler.rb
|
371
371
|
- lib/logstash/compiler/lscl.rb
|
372
|
+
- lib/logstash/compiler/lscl/helpers.rb
|
372
373
|
- lib/logstash/compiler/lscl/lscl_grammar.rb
|
373
374
|
- lib/logstash/compiler/treetop_monkeypatches.rb
|
374
375
|
- lib/logstash/config/config_ast.rb
|
@@ -476,6 +477,8 @@ files:
|
|
476
477
|
- lib/logstash/util/buftok.rb
|
477
478
|
- lib/logstash/util/byte_value.rb
|
478
479
|
- lib/logstash/util/charset.rb
|
480
|
+
- lib/logstash/util/cloud_setting_auth.rb
|
481
|
+
- lib/logstash/util/cloud_setting_id.rb
|
479
482
|
- lib/logstash/util/dead_letter_queue_manager.rb
|
480
483
|
- lib/logstash/util/decorators.rb
|
481
484
|
- lib/logstash/util/duration_formatter.rb
|
@@ -483,6 +486,7 @@ files:
|
|
483
486
|
- lib/logstash/util/filetools.rb
|
484
487
|
- lib/logstash/util/java_version.rb
|
485
488
|
- lib/logstash/util/loggable.rb
|
489
|
+
- lib/logstash/util/modules_setting_array.rb
|
486
490
|
- lib/logstash/util/password.rb
|
487
491
|
- lib/logstash/util/plugin_version.rb
|
488
492
|
- lib/logstash/util/prctl.rb
|
@@ -554,6 +558,7 @@ files:
|
|
554
558
|
- spec/logstash/modules/cli_parser_spec.rb
|
555
559
|
- spec/logstash/modules/logstash_config_spec.rb
|
556
560
|
- spec/logstash/modules/scaffold_spec.rb
|
561
|
+
- spec/logstash/modules/settings_merger_spec.rb
|
557
562
|
- spec/logstash/output_delegator_spec.rb
|
558
563
|
- spec/logstash/outputs/base_spec.rb
|
559
564
|
- spec/logstash/patches_spec.rb
|
@@ -573,6 +578,7 @@ files:
|
|
573
578
|
- spec/logstash/settings/array_coercible_spec.rb
|
574
579
|
- spec/logstash/settings/bytes_spec.rb
|
575
580
|
- spec/logstash/settings/integer_spec.rb
|
581
|
+
- spec/logstash/settings/modules_spec.rb
|
576
582
|
- spec/logstash/settings/numeric_spec.rb
|
577
583
|
- spec/logstash/settings/port_range_spec.rb
|
578
584
|
- spec/logstash/settings/splittable_string_array_spec.rb
|
@@ -691,6 +697,7 @@ test_files:
|
|
691
697
|
- spec/logstash/modules/cli_parser_spec.rb
|
692
698
|
- spec/logstash/modules/logstash_config_spec.rb
|
693
699
|
- spec/logstash/modules/scaffold_spec.rb
|
700
|
+
- spec/logstash/modules/settings_merger_spec.rb
|
694
701
|
- spec/logstash/output_delegator_spec.rb
|
695
702
|
- spec/logstash/outputs/base_spec.rb
|
696
703
|
- spec/logstash/patches_spec.rb
|
@@ -710,6 +717,7 @@ test_files:
|
|
710
717
|
- spec/logstash/settings/array_coercible_spec.rb
|
711
718
|
- spec/logstash/settings/bytes_spec.rb
|
712
719
|
- spec/logstash/settings/integer_spec.rb
|
720
|
+
- spec/logstash/settings/modules_spec.rb
|
713
721
|
- spec/logstash/settings/numeric_spec.rb
|
714
722
|
- spec/logstash/settings/port_range_spec.rb
|
715
723
|
- spec/logstash/settings/splittable_string_array_spec.rb
|