logstash-core 5.6.1-java → 5.6.2-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/runner.rb +5 -1
- data/lib/logstash/version.rb +1 -1
- data/spec/logstash/api/modules/node_stats_spec.rb +5 -1
- data/spec/logstash/event_spec.rb +57 -0
- data/spec/logstash/pipeline_dlq_commit_spec.rb +3 -1
- data/spec/logstash/settings/writable_directory_spec.rb +13 -10
- data/spec/logstash/timestamp_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a1d5e237f74ab92c97ad7b6ec1bd1fa1400d3cb
|
4
|
+
data.tar.gz: 84e307b3937569a7b79b8ab9ec45db1a569e5c3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a94a2b80822a8d1d3ea137799a2cc623815b2b830daba4d8a3a14d6f200e644ceb8bf1fce608c822a21739fe3fed9a61b0912fda51d1b7f127923d96dfac0883
|
7
|
+
data.tar.gz: 1ffd5556efae4a5e2f657834527e29ab841ae339f3d3e70ef4ecf0a49941f61010fe908799aa01a12186c0028446ac76bca2652460b3280cb8c66b823a73998e
|
Binary file
|
data/lib/logstash/runner.rb
CHANGED
@@ -221,7 +221,11 @@ class LogStash::Runner < Clamp::StrictCommand
|
|
221
221
|
java.lang.System.setProperty("ls.log.level", setting("log.level"))
|
222
222
|
unless java.lang.System.getProperty("log4j.configurationFile")
|
223
223
|
log4j_config_location = ::File.join(setting("path.settings"), "log4j2.properties")
|
224
|
-
|
224
|
+
|
225
|
+
# Windows safe way to produce a file: URI.
|
226
|
+
file_schema = "file://" + (LogStash::Environment.windows? ? "/" : "")
|
227
|
+
LogStash::Logging::Logger::reconfigure(URI.join(file_schema + File.absolute_path(log4j_config_location)).to_s)
|
228
|
+
|
225
229
|
end
|
226
230
|
# override log level that may have been introduced from a custom log4j config file
|
227
231
|
LogStash::Logging::Logger::configure_logging(setting("log.level"))
|
data/lib/logstash/version.rb
CHANGED
@@ -70,7 +70,7 @@ describe LogStash::Api::Modules::NodeStats do
|
|
70
70
|
"cpu"=>{
|
71
71
|
"total_in_millis"=>Numeric,
|
72
72
|
"percent"=>Numeric,
|
73
|
-
|
73
|
+
# load_average is not supported on Windows, set it below
|
74
74
|
}
|
75
75
|
},
|
76
76
|
"pipeline" => {
|
@@ -88,5 +88,9 @@ describe LogStash::Api::Modules::NodeStats do
|
|
88
88
|
}
|
89
89
|
}
|
90
90
|
|
91
|
+
unless LogStash::Environment.windows?
|
92
|
+
root_structure["process"]["cpu"]["load_average"] = { "1m" => Numeric }
|
93
|
+
end
|
94
|
+
|
91
95
|
test_api_and_resources(root_structure)
|
92
96
|
end
|
data/spec/logstash/event_spec.rb
CHANGED
@@ -352,4 +352,61 @@ describe LogStash::Event do
|
|
352
352
|
expect { subject.baz() }.to raise_error(NoMethodError, /undefined method `baz' for/)
|
353
353
|
end
|
354
354
|
end
|
355
|
+
|
356
|
+
describe "#clone" do
|
357
|
+
let(:fieldref) { "[@metadata][fancy]" }
|
358
|
+
let(:event1) { LogStash::Event.new("hello" => "world", "@metadata" => { "fancy" => "pants" }) }
|
359
|
+
let(:event2) { LogStash::Event.new("hello" => "world", "@metadata" => { "fancy" => {"fancy2" => "pants2"} }) }
|
360
|
+
let(:event3) { LogStash::Event.new("hello" => "world", "@metadata" => { "fancy" => {"fancy2" => {"fancy3" => "pants2"}} }) }
|
361
|
+
let(:event4) { LogStash::Event.new("hello" => "world", "@metadata" => { "fancy" => {"fancy2" => ["pants1", "pants2"]} }) }
|
362
|
+
let(:event5) { LogStash::Event.new("hello" => "world", "@metadata" => { "fancy" => "pants", "smarty" => "pants2" }) }
|
363
|
+
|
364
|
+
it "should clone metadata fields" do
|
365
|
+
cloned = event1.clone
|
366
|
+
expect(cloned.get(fieldref)).to eq("pants")
|
367
|
+
expect(cloned.to_hash_with_metadata).to include("@metadata")
|
368
|
+
end
|
369
|
+
|
370
|
+
it "should clone metadata fields with nested json" do
|
371
|
+
cloned = event2.clone
|
372
|
+
expect(cloned.get(fieldref)).to eq({"fancy2" => "pants2"})
|
373
|
+
expect(cloned.get("hello")).to eq("world")
|
374
|
+
expect(cloned.to_hash).not_to include("@metadata")
|
375
|
+
expect(cloned.to_hash_with_metadata).to include("@metadata")
|
376
|
+
end
|
377
|
+
|
378
|
+
it "should clone metadata fields with 2-level nested json" do
|
379
|
+
cloned = event3.clone
|
380
|
+
expect(cloned.get(fieldref)).to eq({"fancy2" => {"fancy3" => "pants2"}})
|
381
|
+
expect(cloned.to_hash).not_to include("@metadata")
|
382
|
+
expect(cloned.to_hash_with_metadata).to include("@metadata")
|
383
|
+
end
|
384
|
+
|
385
|
+
it "should clone metadata fields with nested json and array value" do
|
386
|
+
cloned = event4.clone
|
387
|
+
expect(cloned.get(fieldref)).to eq({"fancy2" => ["pants1", "pants2"]})
|
388
|
+
expect(cloned.to_hash_with_metadata).to include("@metadata")
|
389
|
+
end
|
390
|
+
|
391
|
+
it "should clone metadata fields with multiple keys" do
|
392
|
+
cloned = event5.clone
|
393
|
+
expect(cloned.get(fieldref)).to eq("pants")
|
394
|
+
expect(cloned.get("[@metadata][smarty]")).to eq("pants2")
|
395
|
+
expect(cloned.to_hash_with_metadata).to include("@metadata")
|
396
|
+
end
|
397
|
+
|
398
|
+
it "mutating cloned event should not affect the original event" do
|
399
|
+
cloned = event1.clone
|
400
|
+
cloned.set("hello", "foobar")
|
401
|
+
expect(cloned.get("hello")).to eq("foobar")
|
402
|
+
expect(event1.get("hello")).to eq("world")
|
403
|
+
end
|
404
|
+
|
405
|
+
it "mutating cloned event's metadata should not affect the original event metadata" do
|
406
|
+
cloned = event1.clone
|
407
|
+
cloned.set("[@metadata][fancy]", "foobar")
|
408
|
+
expect(cloned.get("[@metadata][fancy]")).to eq("foobar")
|
409
|
+
expect(event1.get("[@metadata][fancy]")).to eq("pants")
|
410
|
+
end
|
411
|
+
end
|
355
412
|
end
|
@@ -67,7 +67,7 @@ describe LogStash::Pipeline do
|
|
67
67
|
end
|
68
68
|
|
69
69
|
after(:each) do
|
70
|
-
FileUtils.
|
70
|
+
FileUtils.rm_rf(pipeline_settings["path.dead_letter_queue"])
|
71
71
|
end
|
72
72
|
|
73
73
|
context "dlq is enabled" do
|
@@ -85,6 +85,7 @@ describe LogStash::Pipeline do
|
|
85
85
|
entry = dlq_reader.pollEntry(40)
|
86
86
|
expect(entry).to_not be_nil
|
87
87
|
expect(entry.reason).to eq("my reason")
|
88
|
+
subject.shutdown
|
88
89
|
end
|
89
90
|
end
|
90
91
|
|
@@ -101,6 +102,7 @@ describe LogStash::Pipeline do
|
|
101
102
|
subject.run
|
102
103
|
dlq_path = java.nio.file.Paths.get(pipeline_settings_obj.get("path.dead_letter_queue"), pipeline_id)
|
103
104
|
expect(java.nio.file.Files.exists(dlq_path)).to eq(false)
|
105
|
+
subject.shutdown
|
104
106
|
end
|
105
107
|
end
|
106
108
|
|
@@ -3,17 +3,17 @@ require "spec_helper"
|
|
3
3
|
require "logstash/settings"
|
4
4
|
require "tmpdir"
|
5
5
|
require "socket" # for UNIXSocket
|
6
|
+
require "fileutils"
|
6
7
|
|
7
8
|
describe LogStash::Setting::WritableDirectory do
|
8
|
-
let(:mode_rx) { 0555 }
|
9
9
|
# linux is 108, Macos is 104, so use a safe value
|
10
10
|
# Stud::Temporary.pathname, will exceed that size without adding anything
|
11
11
|
let(:parent) { File.join(Dir.tmpdir, Time.now.to_f.to_s) }
|
12
12
|
let(:path) { File.join(parent, "fancy") }
|
13
13
|
|
14
14
|
before { Dir.mkdir(parent) }
|
15
|
-
after { Dir.exist?(path) &&
|
16
|
-
after {
|
15
|
+
after { Dir.exist?(path) && FileUtils.rm_rf(path)}
|
16
|
+
after { FileUtils.rm_rf(parent) }
|
17
17
|
|
18
18
|
shared_examples "failure" do
|
19
19
|
before { subject.set(path) }
|
@@ -44,8 +44,9 @@ describe LogStash::Setting::WritableDirectory do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
context "and the directory cannot be created" do
|
47
|
-
before { File.chmod(mode_rx, parent) }
|
48
47
|
it "should fail" do
|
48
|
+
# using chmod does not work on Windows better mock and_raise("message")
|
49
|
+
expect(FileUtils).to receive(:mkdir_p).and_raise("foobar")
|
49
50
|
expect { subject.value }.to raise_error
|
50
51
|
end
|
51
52
|
end
|
@@ -66,7 +67,8 @@ describe LogStash::Setting::WritableDirectory do
|
|
66
67
|
end
|
67
68
|
|
68
69
|
context "but is not writable" do
|
69
|
-
|
70
|
+
# chmod does not work on Windows, mock writable? instead
|
71
|
+
before { expect(File).to receive(:writable?).and_return(false) }
|
70
72
|
it_behaves_like "failure"
|
71
73
|
end
|
72
74
|
end
|
@@ -84,12 +86,13 @@ describe LogStash::Setting::WritableDirectory do
|
|
84
86
|
before { socket } # realize `socket` value
|
85
87
|
after { socket.close }
|
86
88
|
it_behaves_like "failure"
|
87
|
-
end
|
89
|
+
end unless LogStash::Environment.windows?
|
88
90
|
|
91
|
+
|
89
92
|
context "but is a symlink" do
|
90
|
-
before {
|
93
|
+
before { FileUtils.symlink("whatever", path) }
|
91
94
|
it_behaves_like "failure"
|
92
|
-
end
|
95
|
+
end unless LogStash::Environment.windows?
|
93
96
|
end
|
94
97
|
|
95
98
|
context "when the directory is missing" do
|
@@ -114,8 +117,8 @@ describe LogStash::Setting::WritableDirectory do
|
|
114
117
|
|
115
118
|
context "and cannot be created" do
|
116
119
|
before do
|
117
|
-
#
|
118
|
-
File.
|
120
|
+
# chmod does not work on Windows, mock writable? instead
|
121
|
+
expect(File).to receive(:writable?).and_return(false)
|
119
122
|
end
|
120
123
|
|
121
124
|
it_behaves_like "failure"
|
@@ -7,10 +7,10 @@ describe LogStash::Timestamp do
|
|
7
7
|
context "constructors" do
|
8
8
|
it "should work" do
|
9
9
|
t = LogStash::Timestamp.new
|
10
|
-
expect(t.time.to_i).to be_within(
|
10
|
+
expect(t.time.to_i).to be_within(2).of Time.now.to_i
|
11
11
|
|
12
12
|
t = LogStash::Timestamp.now
|
13
|
-
expect(t.time.to_i).to be_within(
|
13
|
+
expect(t.time.to_i).to be_within(2).of Time.now.to_i
|
14
14
|
|
15
15
|
now = Time.now.utc
|
16
16
|
t = LogStash::Timestamp.new(now)
|
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: 5.6.
|
4
|
+
version: 5.6.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|