logstash-output-elasticsearch 2.5.0-java → 2.5.1-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 +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/logstash/outputs/elasticsearch/http_client.rb +5 -2
- data/lib/logstash/outputs/elasticsearch/http_client_builder.rb +3 -2
- data/logstash-output-elasticsearch.gemspec +1 -1
- data/spec/unit/outputs/elasticsearch/http_client_spec.rb +4 -0
- data/spec/unit/outputs/elasticsearch_spec.rb +25 -0
- data/spec/unit/outputs/elasticsearch_ssl_spec.rb +1 -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: e2be6702ec45ea049c714fc3d3481405c8d9d4b5
|
4
|
+
data.tar.gz: 376cb1122b3bc91c2747813dee512cd89bef4bcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f06e6bc71c5faa1ba4296231e0c2f555c4c7caf73031a09a776ec1ff17a127afeaa7967396a41ecbb2ecbf9fd939858fcbd042855d0b72c4e2cffb5edd9f9f63
|
7
|
+
data.tar.gz: c2c403a0690b04aa328eb005312cc1d69d43bc50585e5ef6a0900e0258a8eafa59a7c2c475048e7b15077d5c3982e225bbcb3b6371456cc951b7ae6f1f736ade
|
data/CHANGELOG.md
CHANGED
@@ -105,7 +105,8 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
105
105
|
client_settings = options[:client_settings] || {}
|
106
106
|
timeout = options[:timeout] || 0
|
107
107
|
|
108
|
-
|
108
|
+
host_ssl_opt = client_settings[:ssl].nil? ? nil : client_settings[:ssl][:enabled]
|
109
|
+
urls = hosts.map {|host| host_to_url(host, host_ssl_opt, client_settings[:path])}
|
109
110
|
|
110
111
|
@client_options = {
|
111
112
|
:hosts => urls,
|
@@ -137,8 +138,10 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
137
138
|
"https"
|
138
139
|
when false
|
139
140
|
"http"
|
140
|
-
|
141
|
+
when nil
|
141
142
|
nil
|
143
|
+
else
|
144
|
+
raise ArgumentError, "Unexpected SSL value!"
|
142
145
|
end
|
143
146
|
|
144
147
|
# Ensure path starts with a /
|
@@ -59,7 +59,8 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def self.setup_ssl(logger, params)
|
62
|
-
return {}
|
62
|
+
return {} if params["ssl"].nil?
|
63
|
+
return {:ssl => {:enabled => false}} if params["ssl"] == false
|
63
64
|
|
64
65
|
cacert, truststore, truststore_password, keystore, keystore_password =
|
65
66
|
params.values_at('cacert', 'truststore', 'truststore_password', 'keystore', 'keystore_password')
|
@@ -68,7 +69,7 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
68
69
|
raise(LogStash::ConfigurationError, "Use either \"cacert\" or \"truststore\" when configuring the CA certificate") if truststore
|
69
70
|
end
|
70
71
|
|
71
|
-
ssl_options = {}
|
72
|
+
ssl_options = {:enabled => true}
|
72
73
|
|
73
74
|
if cacert
|
74
75
|
ssl_options[:ca_file] = cacert
|
@@ -58,6 +58,10 @@ describe LogStash::Outputs::ElasticSearch::HttpClient do
|
|
58
58
|
it "should handle an ssl url correctly when SSL is nil" do
|
59
59
|
expect(subject.send(:host_to_url, https_hostname_port, nil)).to eql(https_hostname_port)
|
60
60
|
end
|
61
|
+
|
62
|
+
it "should raise an exception if an unexpected value is passed in" do
|
63
|
+
expect { subject.send(:host_to_url, https_hostname_port, {})}.to raise_error(ArgumentError)
|
64
|
+
end
|
61
65
|
end
|
62
66
|
|
63
67
|
describe "path" do
|
@@ -175,4 +175,29 @@ describe "outputs/elasticsearch" do
|
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
178
|
+
describe "SSL end to end" do
|
179
|
+
shared_examples("an encrypted client connection") do
|
180
|
+
it "should enable SSL in manticore" do
|
181
|
+
expect(eso.client.client_options[:hosts].map {|h| URI.parse(h).scheme}.uniq).to eql(['https'])
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
let(:eso) {LogStash::Outputs::ElasticSearch.new(options)}
|
186
|
+
subject(:manticore) { eso.client.client}
|
187
|
+
|
188
|
+
before do
|
189
|
+
eso.register
|
190
|
+
end
|
191
|
+
|
192
|
+
context "With the 'ssl' option" do
|
193
|
+
let(:options) { {"ssl" => true}}
|
194
|
+
|
195
|
+
include_examples("an encrypted client connection")
|
196
|
+
end
|
197
|
+
|
198
|
+
context "With an https host" do
|
199
|
+
let(:options) { {"hosts" => "https://localhost"} }
|
200
|
+
include_examples("an encrypted client connection")
|
201
|
+
end
|
202
|
+
end
|
178
203
|
end
|
@@ -15,7 +15,7 @@ describe "SSL option" do
|
|
15
15
|
|
16
16
|
it "should pass the flag to the ES client" do
|
17
17
|
expect(::Elasticsearch::Client).to receive(:new) do |args|
|
18
|
-
expect(args[:ssl]).to eq(:verify => false)
|
18
|
+
expect(args[:ssl]).to eq(:enabled => true, :verify => false)
|
19
19
|
end
|
20
20
|
subject.register
|
21
21
|
end
|
@@ -44,7 +44,6 @@ describe "SSL option" do
|
|
44
44
|
next LogStash::Outputs::ElasticSearch.new(settings)
|
45
45
|
end
|
46
46
|
|
47
|
-
|
48
47
|
it "should pass the keystore parameters to the ES client" do
|
49
48
|
expect(::Elasticsearch::Client).to receive(:new) do |args|
|
50
49
|
expect(args[:ssl]).to include(:keystore => keystore_path, :keystore_password => "test")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|