logstash-core 2.3.4.snapshot1-java → 2.4.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.
Potentially problematic release.
This version of logstash-core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/logstash-core/version.rb +1 -1
- data/lib/logstash/agent.rb +28 -10
- data/lib/logstash/codecs/base.rb +29 -1
- data/lib/logstash/config/mixin.rb +62 -23
- data/lib/logstash/inputs/base.rb +1 -1
- data/lib/logstash/instrument/null_metric.rb +45 -0
- data/lib/logstash/logging/json.rb +21 -0
- data/lib/logstash/output_delegator.rb +3 -3
- data/lib/logstash/outputs/base.rb +32 -1
- data/lib/logstash/pipeline.rb +1 -1
- data/lib/logstash/plugin.rb +11 -1
- data/lib/logstash/util/safe_uri.rb +50 -0
- data/lib/logstash/version.rb +1 -1
- data/locales/en.yml +4 -0
- data/logstash-core.gemspec +3 -2
- data/spec/logstash/agent_spec.rb +8 -3
- data/spec/logstash/codecs/base_spec.rb +74 -0
- data/spec/logstash/config/mixin_spec.rb +157 -0
- data/spec/logstash/instrument/null_metric_spec.rb +63 -0
- data/spec/logstash/output_delegator_spec.rb +1 -0
- data/spec/logstash/outputs/base_spec.rb +107 -0
- data/spec/logstash/plugin_spec.rb +29 -3
- data/spec/logstash/runner_spec.rb +27 -0
- data/spec/logstash/shutdown_watcher_spec.rb +1 -0
- metadata +15 -8
@@ -16,6 +16,7 @@ describe LogStash::OutputDelegator do
|
|
16
16
|
allow(out_klass).to receive(:new).with(any_args).and_return(out_inst)
|
17
17
|
allow(out_klass).to receive(:threadsafe?).and_return(false)
|
18
18
|
allow(out_klass).to receive(:workers_not_supported?).and_return(false)
|
19
|
+
allow(out_klass).to receive(:name).and_return("example")
|
19
20
|
allow(out_inst).to receive(:register)
|
20
21
|
allow(out_inst).to receive(:multi_receive)
|
21
22
|
allow(logger).to receive(:debug).with(any_args)
|
@@ -15,6 +15,31 @@ class LogStash::Outputs::NOOP < LogStash::Outputs::Base
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
|
19
|
+
# use a dummy NOOP output to test Outputs::Base
|
20
|
+
class LogStash::Outputs::NOOPSingle < LogStash::Outputs::Base
|
21
|
+
config_name "noop single"
|
22
|
+
concurrency :single
|
23
|
+
|
24
|
+
config :dummy_option, :validate => :string
|
25
|
+
|
26
|
+
def register; end
|
27
|
+
|
28
|
+
def receive(event)
|
29
|
+
return output?(event)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class LogStash::Outputs::NOOPShared < ::LogStash::Outputs::Base
|
34
|
+
concurrency :shared
|
35
|
+
|
36
|
+
def register; end
|
37
|
+
end
|
38
|
+
|
39
|
+
class LogStash::Outputs::NOOPLegacy < ::LogStash::Outputs::Base
|
40
|
+
def register; end
|
41
|
+
end
|
42
|
+
|
18
43
|
class LogStash::Outputs::NOOPLegacyNoWorkers < ::LogStash::Outputs::Base
|
19
44
|
LEGACY_WORKERS_NOT_SUPPORTED_REASON = "legacy reason"
|
20
45
|
|
@@ -23,7 +48,52 @@ class LogStash::Outputs::NOOPLegacyNoWorkers < ::LogStash::Outputs::Base
|
|
23
48
|
end
|
24
49
|
end
|
25
50
|
|
51
|
+
class LogStash::Outputs::NOOPMultiReceiveEncoded < ::LogStash::Outputs::Base
|
52
|
+
concurrency :single
|
53
|
+
|
54
|
+
def register; end
|
55
|
+
|
56
|
+
def multi_receive_encoded(events_and_encoded)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
26
60
|
describe "LogStash::Outputs::Base#new" do
|
61
|
+
describe "concurrency" do
|
62
|
+
subject { klass.new({}) }
|
63
|
+
|
64
|
+
context "single" do
|
65
|
+
let(:klass) { LogStash::Outputs::NOOPSingle }
|
66
|
+
|
67
|
+
it "should set concurrency correctly" do
|
68
|
+
expect(subject.concurrency).to eq(:single)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context "shared" do
|
73
|
+
let(:klass) { LogStash::Outputs::NOOPShared }
|
74
|
+
|
75
|
+
it "should set concurrency correctly" do
|
76
|
+
expect(subject.concurrency).to eq(:shared)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
context "legacy" do
|
81
|
+
let(:klass) { LogStash::Outputs::NOOPLegacy }
|
82
|
+
|
83
|
+
it "should set concurrency correctly" do
|
84
|
+
expect(subject.concurrency).to eq(:legacy)
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should default the # of workers to 1" do
|
88
|
+
expect(subject.workers).to eq(1)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should default concurrency to :legacy" do
|
92
|
+
expect(subject.concurrency).to eq(:legacy)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
27
97
|
it "should instantiate cleanly" do
|
28
98
|
params = { "dummy_option" => "potatoes", "codec" => "json", "workers" => 2 }
|
29
99
|
worker_params = params.dup; worker_params["workers"] = 1
|
@@ -37,4 +107,41 @@ describe "LogStash::Outputs::Base#new" do
|
|
37
107
|
LogStash::Outputs::NOOPLegacyNoWorkers.new.register
|
38
108
|
expect(LogStash::Outputs::NOOPLegacyNoWorkers.workers_not_supported?).to eql(true)
|
39
109
|
end
|
110
|
+
|
111
|
+
describe "dispatching multi_receive" do
|
112
|
+
let(:event) { double("event") }
|
113
|
+
let(:events) { [event] }
|
114
|
+
subject { klass.new({}) }
|
115
|
+
|
116
|
+
context "with multi_receive_encoded" do
|
117
|
+
let(:klass) { LogStash::Outputs::NOOPMultiReceiveEncoded }
|
118
|
+
let(:codec) { double("codec") }
|
119
|
+
let(:encoded) { double("encoded") }
|
120
|
+
|
121
|
+
before do
|
122
|
+
allow(codec).to receive(:multi_encode).with(events).and_return(encoded)
|
123
|
+
allow(subject).to receive(:codec).and_return(codec)
|
124
|
+
allow(subject).to receive(:multi_receive_encoded)
|
125
|
+
subject.multi_receive(events)
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should invoke multi_receive_encoded if it exists" do
|
129
|
+
expect(subject).to have_received(:multi_receive_encoded).with(encoded)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
context "with plain #receive" do
|
134
|
+
let(:klass) { LogStash::Outputs::NOOPSingle }
|
135
|
+
|
136
|
+
before do
|
137
|
+
allow(subject).to receive(:multi_receive).and_call_original
|
138
|
+
allow(subject).to receive(:receive).with(event)
|
139
|
+
subject.multi_receive(events)
|
140
|
+
end
|
141
|
+
|
142
|
+
it "should receive the event by itself" do
|
143
|
+
expect(subject).to have_received(:receive).with(event)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
40
147
|
end
|
@@ -1,15 +1,18 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require "spec_helper"
|
3
2
|
require "logstash/plugin"
|
3
|
+
require "logstash/inputs/base"
|
4
|
+
require "logstash/filters/base"
|
5
|
+
require "logstash/outputs/base"
|
6
|
+
require "spec_helper"
|
4
7
|
|
5
8
|
describe LogStash::Plugin do
|
6
9
|
it "should fail lookup on inexisting type" do
|
7
|
-
expect_any_instance_of(Cabin::Channel).to receive(:debug).once
|
10
|
+
#expect_any_instance_of(Cabin::Channel).to receive(:debug).once
|
8
11
|
expect { LogStash::Plugin.lookup("badbadtype", "badname") }.to raise_error(LogStash::PluginLoadingError)
|
9
12
|
end
|
10
13
|
|
11
14
|
it "should fail lookup on inexisting name" do
|
12
|
-
expect_any_instance_of(Cabin::Channel).to receive(:debug).once
|
15
|
+
#expect_any_instance_of(Cabin::Channel).to receive(:debug).once
|
13
16
|
expect { LogStash::Plugin.lookup("filter", "badname") }.to raise_error(LogStash::PluginLoadingError)
|
14
17
|
end
|
15
18
|
|
@@ -166,4 +169,27 @@ describe LogStash::Plugin do
|
|
166
169
|
|
167
170
|
end
|
168
171
|
end
|
172
|
+
context "Collecting Metric in the plugin" do
|
173
|
+
[LogStash::Inputs::Base, LogStash::Filters::Base, LogStash::Outputs::Base].each do |type|
|
174
|
+
let(:plugin) do
|
175
|
+
Class.new(type) do
|
176
|
+
config_name "goku"
|
177
|
+
|
178
|
+
def register
|
179
|
+
metric.gauge("power-level", 9000)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
subject { plugin.new }
|
185
|
+
|
186
|
+
it "should not raise an exception when recoding a metric" do
|
187
|
+
expect { subject.register }.not_to raise_error
|
188
|
+
end
|
189
|
+
|
190
|
+
it "should use a `NullMetric`" do
|
191
|
+
expect(subject.metric).to be_kind_of(LogStash::Instrument::NullMetric)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
169
195
|
end
|
@@ -3,6 +3,7 @@ require "spec_helper"
|
|
3
3
|
require "logstash/runner"
|
4
4
|
require "stud/task"
|
5
5
|
require "stud/trap"
|
6
|
+
require "stud/temporary"
|
6
7
|
|
7
8
|
class NullRunner
|
8
9
|
def run(args); end
|
@@ -14,6 +15,7 @@ describe LogStash::Runner do
|
|
14
15
|
|
15
16
|
before :each do
|
16
17
|
allow(Cabin::Channel).to receive(:get).with(LogStash).and_return(channel)
|
18
|
+
allow(channel).to receive(:subscribe).with(any_args).and_call_original
|
17
19
|
end
|
18
20
|
|
19
21
|
context "argument parsing" do
|
@@ -54,4 +56,29 @@ describe LogStash::Runner do
|
|
54
56
|
end
|
55
57
|
end
|
56
58
|
end
|
59
|
+
|
60
|
+
context "--log-in-json" do
|
61
|
+
let(:logfile) { Stud::Temporary.file }
|
62
|
+
let(:args) { [ "agent", "--log-in-json", "-l", logfile.path, "-e", "some-invalid-config" ] }
|
63
|
+
|
64
|
+
after do
|
65
|
+
logfile.close
|
66
|
+
File.unlink(logfile.path)
|
67
|
+
end
|
68
|
+
|
69
|
+
before do
|
70
|
+
expect(channel).to receive(:subscribe).with(kind_of(LogStash::Logging::JSON)).and_call_original
|
71
|
+
subject.run(args).wait
|
72
|
+
|
73
|
+
# Log file should have stuff in it.
|
74
|
+
expect(logfile.stat.size).to be > 0
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should log in valid json. One object per line." do
|
78
|
+
logfile.each_line do |line|
|
79
|
+
expect(line).not_to be_empty
|
80
|
+
expect { LogStash::Json.load(line) }.not_to raise_error
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
57
84
|
end
|
@@ -20,6 +20,7 @@ describe LogStash::ShutdownWatcher do
|
|
20
20
|
allow(pipeline).to receive(:thread).and_return(Thread.current)
|
21
21
|
allow(reporter).to receive(:snapshot).and_return(reporter_snapshot)
|
22
22
|
allow(reporter_snapshot).to receive(:o_simple_hash).and_return({})
|
23
|
+
allow(reporter_snapshot).to receive(:to_json_data).and_return("reporter-double")
|
23
24
|
|
24
25
|
allow(subject).to receive(:pipeline_report_snapshot).and_wrap_original do |m, *args|
|
25
26
|
report_count += 1
|
metadata
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
16
|
- - '='
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 2.
|
18
|
+
version: 2.4.0
|
19
19
|
name: logstash-core-event
|
20
20
|
prerelease: false
|
21
21
|
type: :runtime
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.4.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
@@ -127,7 +127,7 @@ dependencies:
|
|
127
127
|
requirements:
|
128
128
|
- - '='
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version: 0.9.
|
130
|
+
version: 0.9.16
|
131
131
|
name: jruby-openssl
|
132
132
|
prerelease: false
|
133
133
|
type: :runtime
|
@@ -135,7 +135,7 @@ dependencies:
|
|
135
135
|
requirements:
|
136
136
|
- - '='
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.9.
|
138
|
+
version: 0.9.16
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
requirement: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
@@ -245,9 +245,11 @@ files:
|
|
245
245
|
- lib/logstash/filters/base.rb
|
246
246
|
- lib/logstash/inputs/base.rb
|
247
247
|
- lib/logstash/inputs/threadable.rb
|
248
|
+
- lib/logstash/instrument/null_metric.rb
|
248
249
|
- lib/logstash/java_integration.rb
|
249
250
|
- lib/logstash/json.rb
|
250
251
|
- lib/logstash/logging.rb
|
252
|
+
- lib/logstash/logging/json.rb
|
251
253
|
- lib/logstash/namespace.rb
|
252
254
|
- lib/logstash/output_delegator.rb
|
253
255
|
- lib/logstash/outputs/base.rb
|
@@ -275,6 +277,7 @@ files:
|
|
275
277
|
- lib/logstash/util/plugin_version.rb
|
276
278
|
- lib/logstash/util/prctl.rb
|
277
279
|
- lib/logstash/util/retryable.rb
|
280
|
+
- lib/logstash/util/safe_uri.rb
|
278
281
|
- lib/logstash/util/socket_peer.rb
|
279
282
|
- lib/logstash/util/unicode_trimmer.rb
|
280
283
|
- lib/logstash/util/worker_threads_default_printer.rb
|
@@ -284,6 +287,7 @@ files:
|
|
284
287
|
- logstash-core.gemspec
|
285
288
|
- spec/conditionals_spec.rb
|
286
289
|
- spec/logstash/agent_spec.rb
|
290
|
+
- spec/logstash/codecs/base_spec.rb
|
287
291
|
- spec/logstash/config/config_ast_spec.rb
|
288
292
|
- spec/logstash/config/cpu_core_strategy_spec.rb
|
289
293
|
- spec/logstash/config/defaults_spec.rb
|
@@ -292,6 +296,7 @@ files:
|
|
292
296
|
- spec/logstash/environment_spec.rb
|
293
297
|
- spec/logstash/filters/base_spec.rb
|
294
298
|
- spec/logstash/inputs/base_spec.rb
|
299
|
+
- spec/logstash/instrument/null_metric_spec.rb
|
295
300
|
- spec/logstash/java_integration_spec.rb
|
296
301
|
- spec/logstash/json_spec.rb
|
297
302
|
- spec/logstash/output_delegator_spec.rb
|
@@ -327,9 +332,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
327
332
|
version: '0'
|
328
333
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
329
334
|
requirements:
|
330
|
-
- - "
|
335
|
+
- - ">="
|
331
336
|
- !ruby/object:Gem::Version
|
332
|
-
version:
|
337
|
+
version: '0'
|
333
338
|
requirements: []
|
334
339
|
rubyforge_project:
|
335
340
|
rubygems_version: 2.4.8
|
@@ -339,6 +344,7 @@ summary: logstash-core - The core components of logstash
|
|
339
344
|
test_files:
|
340
345
|
- spec/conditionals_spec.rb
|
341
346
|
- spec/logstash/agent_spec.rb
|
347
|
+
- spec/logstash/codecs/base_spec.rb
|
342
348
|
- spec/logstash/config/config_ast_spec.rb
|
343
349
|
- spec/logstash/config/cpu_core_strategy_spec.rb
|
344
350
|
- spec/logstash/config/defaults_spec.rb
|
@@ -347,6 +353,7 @@ test_files:
|
|
347
353
|
- spec/logstash/environment_spec.rb
|
348
354
|
- spec/logstash/filters/base_spec.rb
|
349
355
|
- spec/logstash/inputs/base_spec.rb
|
356
|
+
- spec/logstash/instrument/null_metric_spec.rb
|
350
357
|
- spec/logstash/java_integration_spec.rb
|
351
358
|
- spec/logstash/json_spec.rb
|
352
359
|
- spec/logstash/output_delegator_spec.rb
|