logstash-output-elasticsearch 11.10.0-java → 11.12.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/docs/index.asciidoc +22 -7
- data/lib/logstash/outputs/elasticsearch/http_client.rb +5 -9
- data/lib/logstash/outputs/elasticsearch/template_manager.rb +26 -3
- data/lib/logstash/outputs/elasticsearch.rb +5 -0
- data/lib/logstash/plugin_mixins/elasticsearch/common.rb +18 -5
- data/logstash-output-elasticsearch.gemspec +1 -1
- data/spec/unit/outputs/elasticsearch/http_client_spec.rb +0 -21
- data/spec/unit/outputs/elasticsearch/template_manager_spec.rb +49 -0
- data/spec/unit/outputs/elasticsearch_spec.rb +69 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 497559fc1591316e5d904dfdfa907c63397a074a32cb54e4d249bb1e678a4d94
|
4
|
+
data.tar.gz: 0cab607b8ed00108dc733658a27e7e7a3e7a384d70ac9a69ebff7069a6d8a629
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ce4e493f7b1951fc69ceb16e8f3370423e57ebfb19f069c14b41172a2a6597940eafd721878754649779e5c93f906dd21cb58c0c26689ff393773b7e866e9d5
|
7
|
+
data.tar.gz: d7299fc74267f8ba104842bd47493a744f0e683ab7ec51fe241cd4f53c6e5c63a6e597acbadc0174d661e630370d342b4c84581774ece082b2cc3b426aab93f0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 11.12.0
|
2
|
+
- Add legacy template API support for Elasticsearch 8 [#1092](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1092)
|
3
|
+
|
4
|
+
## 11.11.0
|
5
|
+
- When using an `api_key` along with either `cloud_id` or https `hosts`, you no longer need to also specify `ssl => true` [#1065](https://github.com/logstash-plugins/logstash-output-elasticsearch/issues/1065)
|
6
|
+
|
1
7
|
## 11.10.0
|
2
8
|
- Feature: expose `dlq_routed` document metric to track the documents routed into DLQ [#1090](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1090)
|
3
9
|
|
data/docs/index.asciidoc
CHANGED
@@ -362,6 +362,7 @@ This plugin supports the following configuration options plus the
|
|
362
362
|
| <<plugins-{type}s-{plugin}-ssl_certificate_verification>> |<<boolean,boolean>>|No
|
363
363
|
| <<plugins-{type}s-{plugin}-ssl_supported_protocols>> |<<string,string>>|No
|
364
364
|
| <<plugins-{type}s-{plugin}-template>> |a valid filesystem path|No
|
365
|
+
| <<plugins-{type}s-{plugin}-template_api>> |<<string,string>>, one of `["auto", "legacy", "composable"]`|No
|
365
366
|
| <<plugins-{type}s-{plugin}-template_name>> |<<string,string>>|No
|
366
367
|
| <<plugins-{type}s-{plugin}-template_overwrite>> |<<boolean,boolean>>|No
|
367
368
|
| <<plugins-{type}s-{plugin}-timeout>> |<<number,number>>|No
|
@@ -406,8 +407,8 @@ For more details on actions, check out the {ref}/docs-bulk.html[Elasticsearch bu
|
|
406
407
|
* Value type is <<password,password>>
|
407
408
|
* There is no default value for this setting.
|
408
409
|
|
409
|
-
Authenticate using Elasticsearch API key.
|
410
|
-
|
410
|
+
Authenticate using Elasticsearch API key.
|
411
|
+
Note that this option also requires SSL/TLS, which can be enabled by supplying a <<plugins-{type}s-{plugin}-cloud_id>>, a list of HTTPS <<plugins-{type}s-{plugin}-hosts>>, or by setting <<plugins-{type}s-{plugin}-ssl,`ssl => true`>>.
|
411
412
|
|
412
413
|
Format is `id:api_key` where `id` and `api_key` are as returned by the
|
413
414
|
Elasticsearch {ref}/security-api-create-api-key.html[Create API key API].
|
@@ -1040,11 +1041,9 @@ do not use full URL here, only paths, e.g. "/sniff/_nodes/http"
|
|
1040
1041
|
* Value type is <<boolean,boolean>>
|
1041
1042
|
* There is no default value for this setting.
|
1042
1043
|
|
1043
|
-
Enable SSL/TLS secured communication to Elasticsearch cluster.
|
1044
|
-
unspecified will use whatever scheme is specified in the URLs listed in
|
1045
|
-
If no explicit protocol is specified plain HTTP will be used.
|
1046
|
-
explicitly disabled here the plugin will refuse to start if an HTTPS URL is
|
1047
|
-
given in 'hosts'
|
1044
|
+
Enable SSL/TLS secured communication to Elasticsearch cluster.
|
1045
|
+
Leaving this unspecified will use whatever scheme is specified in the URLs listed in <<plugins-{type}s-{plugin}-hosts>> or extracted from the <<plugins-{type}s-{plugin}-cloud_id>>.
|
1046
|
+
If no explicit protocol is specified plain HTTP will be used.
|
1048
1047
|
|
1049
1048
|
[id="plugins-{type}s-{plugin}-ssl_certificate_verification"]
|
1050
1049
|
===== `ssl_certificate_verification`
|
@@ -1082,6 +1081,22 @@ the *$JDK_HOME/conf/security/java.security* configuration file. That is, `TLSv1.
|
|
1082
1081
|
You can set the path to your own template here, if you so desire.
|
1083
1082
|
If not set, the included template will be used.
|
1084
1083
|
|
1084
|
+
[id="plugins-{type}s-{plugin}-template_api"]
|
1085
|
+
===== `template_api`
|
1086
|
+
|
1087
|
+
* Value can be any of: `auto`, `legacy`, `composable`
|
1088
|
+
* Default value is `auto`
|
1089
|
+
|
1090
|
+
The default setting of `auto` will use
|
1091
|
+
{ref}/index-templates.html[index template API] to create index template, if the
|
1092
|
+
Elasticsearch cluster is running Elasticsearch version `8.0.0` or higher,
|
1093
|
+
and use {ref}/indices-templates-v1.html[legacy template API] otherwise.
|
1094
|
+
|
1095
|
+
Setting this flag to `legacy` will use legacy template API to create index template.
|
1096
|
+
Setting this flag to `composable` will use index template API to create index template.
|
1097
|
+
|
1098
|
+
NOTE: The format of template provided to <<plugins-{type}s-{plugin}-template>> needs to match the template API being used.
|
1099
|
+
|
1085
1100
|
[id="plugins-{type}s-{plugin}-template_name"]
|
1086
1101
|
===== `template_name`
|
1087
1102
|
|
@@ -77,12 +77,12 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
77
77
|
}
|
78
78
|
end
|
79
79
|
|
80
|
-
def template_install(name, template, force=false)
|
81
|
-
if template_exists?(name) && !force
|
80
|
+
def template_install(template_endpoint, name, template, force=false)
|
81
|
+
if template_exists?(template_endpoint, name) && !force
|
82
82
|
@logger.debug("Found existing Elasticsearch template, skipping template management", name: name)
|
83
83
|
return
|
84
84
|
end
|
85
|
-
template_put(name, template)
|
85
|
+
template_put(template_endpoint, name, template)
|
86
86
|
end
|
87
87
|
|
88
88
|
def last_es_version
|
@@ -402,20 +402,16 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
402
402
|
response.code >= 200 && response.code <= 299
|
403
403
|
end
|
404
404
|
|
405
|
-
def template_exists?(name)
|
405
|
+
def template_exists?(template_endpoint, name)
|
406
406
|
exists?("/#{template_endpoint}/#{name}")
|
407
407
|
end
|
408
408
|
|
409
|
-
def template_put(name, template)
|
409
|
+
def template_put(template_endpoint, name, template)
|
410
410
|
path = "#{template_endpoint}/#{name}"
|
411
411
|
logger.info("Installing Elasticsearch template", name: name)
|
412
412
|
@pool.put(path, nil, LogStash::Json.dump(template))
|
413
413
|
end
|
414
414
|
|
415
|
-
def template_endpoint
|
416
|
-
maximum_seen_major_version < 8 ? '_template' : '_index_template'
|
417
|
-
end
|
418
|
-
|
419
415
|
# ILM methods
|
420
416
|
|
421
417
|
# check whether rollover alias already exists
|
@@ -1,8 +1,20 @@
|
|
1
1
|
module LogStash; module Outputs; class ElasticSearch
|
2
2
|
class TemplateManager
|
3
|
+
LEGACY_TEMPLATE_ENDPOINT = '_template'.freeze
|
4
|
+
INDEX_TEMPLATE_ENDPOINT = '_index_template'.freeze
|
5
|
+
|
3
6
|
# To be mixed into the elasticsearch plugin base
|
4
7
|
def self.install_template(plugin)
|
5
8
|
return unless plugin.manage_template
|
9
|
+
|
10
|
+
if plugin.maximum_seen_major_version < 8 && plugin.template_api == 'auto'
|
11
|
+
plugin.logger.warn("`template_api => auto` resolved to `legacy` since we are connected to " + "Elasticsearch #{plugin.maximum_seen_major_version}, " +
|
12
|
+
"but will resolve to `composable` the first time it connects to Elasticsearch 8+. " +
|
13
|
+
"We recommend either setting `template_api => legacy` to continue providing legacy-style templates, " +
|
14
|
+
"or migrating your template to the composable style and setting `template_api => composable`. " +
|
15
|
+
"The legacy template API is slated for removal in Elasticsearch 9.")
|
16
|
+
end
|
17
|
+
|
6
18
|
if plugin.template
|
7
19
|
plugin.logger.info("Using mapping template from", :path => plugin.template)
|
8
20
|
template = read_template_file(plugin.template)
|
@@ -14,7 +26,7 @@ module LogStash; module Outputs; class ElasticSearch
|
|
14
26
|
|
15
27
|
add_ilm_settings_to_template(plugin, template) if plugin.ilm_in_use?
|
16
28
|
plugin.logger.debug("Attempting to install template", template: template)
|
17
|
-
install(plugin.client, template_name(plugin), template, plugin.template_overwrite)
|
29
|
+
install(plugin.client, template_endpoint(plugin), template_name(plugin), template, plugin.template_overwrite)
|
18
30
|
end
|
19
31
|
|
20
32
|
private
|
@@ -25,8 +37,8 @@ module LogStash; module Outputs; class ElasticSearch
|
|
25
37
|
fail "Failed to load default template for Elasticsearch v#{es_major_version} with ECS #{ecs_compatibility}; caused by: #{e.inspect}"
|
26
38
|
end
|
27
39
|
|
28
|
-
def self.install(client, template_name, template, template_overwrite)
|
29
|
-
client.template_install(template_name, template, template_overwrite)
|
40
|
+
def self.install(client, template_endpoint, template_name, template, template_overwrite)
|
41
|
+
client.template_install(template_endpoint, template_name, template, template_overwrite)
|
30
42
|
end
|
31
43
|
|
32
44
|
def self.add_ilm_settings_to_template(plugin, template)
|
@@ -63,5 +75,16 @@ module LogStash; module Outputs; class ElasticSearch
|
|
63
75
|
template_data = ::IO.read(template_path)
|
64
76
|
LogStash::Json.load(template_data)
|
65
77
|
end
|
78
|
+
|
79
|
+
def self.template_endpoint(plugin)
|
80
|
+
if plugin.template_api == 'auto'
|
81
|
+
plugin.maximum_seen_major_version < 8 ? LEGACY_TEMPLATE_ENDPOINT : INDEX_TEMPLATE_ENDPOINT
|
82
|
+
elsif plugin.template_api.to_s == 'legacy'
|
83
|
+
LEGACY_TEMPLATE_ENDPOINT
|
84
|
+
else
|
85
|
+
INDEX_TEMPLATE_ENDPOINT
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
66
89
|
end
|
67
90
|
end end end
|
@@ -185,6 +185,11 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
|
|
185
185
|
# the "logstash" template (i.e. removing all customized settings)
|
186
186
|
config :template_overwrite, :validate => :boolean, :default => false
|
187
187
|
|
188
|
+
# Flag for enabling legacy template api for Elasticsearch 8
|
189
|
+
# Default auto will use index template api for Elasticsearch 8 and use legacy api for 7
|
190
|
+
# Set to legacy to use legacy template api
|
191
|
+
config :template_api, :validate => ['auto', 'legacy', 'composable'], :default => 'auto'
|
192
|
+
|
188
193
|
# The version to use for indexing. Use sprintf syntax like `%{my_version}` to use a field value here.
|
189
194
|
# See https://www.elastic.co/blog/elasticsearch-versioning-support.
|
190
195
|
config :version, :validate => :string
|
@@ -23,10 +23,14 @@ module LogStash; module PluginMixins; module ElasticSearch
|
|
23
23
|
# because they must be executed prior to building the client and logstash
|
24
24
|
# monitoring and management rely on directly calling build_client
|
25
25
|
# see https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/934#pullrequestreview-396203307
|
26
|
-
validate_authentication
|
27
26
|
fill_hosts_from_cloud_id
|
27
|
+
validate_authentication
|
28
|
+
|
28
29
|
setup_hosts
|
29
30
|
|
31
|
+
|
32
|
+
params['ssl'] = effectively_ssl? unless params.include?('ssl')
|
33
|
+
|
30
34
|
# inject the TrustStrategy from CATrustedFingerprintSupport
|
31
35
|
if trust_strategy_for_ca_trusted_fingerprint
|
32
36
|
params["ssl_trust_strategy"] = trust_strategy_for_ca_trusted_fingerprint
|
@@ -49,7 +53,7 @@ module LogStash; module PluginMixins; module ElasticSearch
|
|
49
53
|
raise LogStash::ConfigurationError, 'Multiple authentication options are specified, please only use one of user/password, cloud_auth or api_key'
|
50
54
|
end
|
51
55
|
|
52
|
-
if @api_key && @api_key.value &&
|
56
|
+
if @api_key && @api_key.value && !effectively_ssl?
|
53
57
|
raise(LogStash::ConfigurationError, "Using api_key authentication requires SSL/TLS secured communication using the `ssl => true` option")
|
54
58
|
end
|
55
59
|
|
@@ -69,6 +73,15 @@ module LogStash; module PluginMixins; module ElasticSearch
|
|
69
73
|
end
|
70
74
|
end
|
71
75
|
|
76
|
+
def effectively_ssl?
|
77
|
+
return @ssl unless @ssl.nil?
|
78
|
+
|
79
|
+
hosts = Array(@hosts)
|
80
|
+
return false if hosts.nil? || hosts.empty?
|
81
|
+
|
82
|
+
hosts.all? { |host| host && host.scheme == "https" }
|
83
|
+
end
|
84
|
+
|
72
85
|
def hosts_default?(hosts)
|
73
86
|
# NOTE: would be nice if pipeline allowed us a clean way to detect a config default :
|
74
87
|
hosts.is_a?(Array) && hosts.size == 1 && hosts.first.equal?(LogStash::PluginMixins::ElasticSearch::APIConfigs::DEFAULT_HOST)
|
@@ -208,12 +221,12 @@ module LogStash; module PluginMixins; module ElasticSearch
|
|
208
221
|
|
209
222
|
def handle_dlq_response(message, action, status, response)
|
210
223
|
_, action_params = action.event, [action[0], action[1], action[2]]
|
211
|
-
|
224
|
+
|
212
225
|
# TODO: Change this to send a map with { :status => status, :action => action } in the future
|
213
226
|
detailed_message = "#{message} status: #{status}, action: #{action_params}, response: #{response}"
|
214
|
-
|
227
|
+
|
215
228
|
log_level = dig_value(response, 'index', 'error', 'type') == 'invalid_index_name_exception' ? :error : :warn
|
216
|
-
|
229
|
+
|
217
230
|
handle_dlq_status(action.event, log_level, detailed_message)
|
218
231
|
end
|
219
232
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-elasticsearch'
|
3
|
-
s.version = '11.
|
3
|
+
s.version = '11.12.0'
|
4
4
|
s.licenses = ['apache-2.0']
|
5
5
|
s.summary = "Stores logs in Elasticsearch"
|
6
6
|
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
@@ -140,27 +140,6 @@ describe LogStash::Outputs::ElasticSearch::HttpClient do
|
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
|
-
describe "index template" do
|
144
|
-
subject { described_class.new(base_options) }
|
145
|
-
let(:template_name) { "logstash" }
|
146
|
-
let(:template) { {} }
|
147
|
-
let(:get_response) {
|
148
|
-
double("response", :body => {})
|
149
|
-
}
|
150
|
-
|
151
|
-
it "should call composable index template in version 8+" do
|
152
|
-
expect(subject).to receive(:maximum_seen_major_version).and_return(8)
|
153
|
-
expect(subject.pool).to receive(:put).with("_index_template/#{template_name}", nil, anything).and_return(get_response)
|
154
|
-
subject.template_put(template_name, template)
|
155
|
-
end
|
156
|
-
|
157
|
-
it "should call index template in version < 8" do
|
158
|
-
expect(subject).to receive(:maximum_seen_major_version).and_return(7)
|
159
|
-
expect(subject.pool).to receive(:put).with("_template/#{template_name}", nil, anything).and_return(get_response)
|
160
|
-
subject.template_put(template_name, template)
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
143
|
describe "join_bulk_responses" do
|
165
144
|
subject { described_class.new(base_options) }
|
166
145
|
|
@@ -63,4 +63,53 @@ describe LogStash::Outputs::ElasticSearch::TemplateManager do
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
66
|
+
|
67
|
+
describe "template endpoint" do
|
68
|
+
describe "template_api => 'auto'" do
|
69
|
+
let(:plugin_settings) { {"manage_template" => true, "template_api" => 'auto'} }
|
70
|
+
let(:plugin) { LogStash::Outputs::ElasticSearch.new(plugin_settings) }
|
71
|
+
|
72
|
+
describe "in version 8+" do
|
73
|
+
it "should use index template API" do
|
74
|
+
expect(plugin).to receive(:maximum_seen_major_version).at_least(:once).and_return(8)
|
75
|
+
endpoint = described_class.template_endpoint(plugin)
|
76
|
+
expect(endpoint).to be_equal(LogStash::Outputs::ElasticSearch::TemplateManager::INDEX_TEMPLATE_ENDPOINT)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe "in version < 8" do
|
81
|
+
it "should use legacy template API" do
|
82
|
+
expect(plugin).to receive(:maximum_seen_major_version).at_least(:once).and_return(7)
|
83
|
+
endpoint = described_class.template_endpoint(plugin)
|
84
|
+
expect(endpoint).to be_equal(LogStash::Outputs::ElasticSearch::TemplateManager::LEGACY_TEMPLATE_ENDPOINT)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe "template_api => 'legacy'" do
|
90
|
+
let(:plugin_settings) { {"manage_template" => true, "template_api" => 'legacy'} }
|
91
|
+
let(:plugin) { LogStash::Outputs::ElasticSearch.new(plugin_settings) }
|
92
|
+
|
93
|
+
describe "in version 8+" do
|
94
|
+
it "should use legacy template API" do
|
95
|
+
expect(plugin).to receive(:maximum_seen_major_version).never
|
96
|
+
endpoint = described_class.template_endpoint(plugin)
|
97
|
+
expect(endpoint).to be_equal(LogStash::Outputs::ElasticSearch::TemplateManager::LEGACY_TEMPLATE_ENDPOINT)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
describe "template_api => 'composable'" do
|
103
|
+
let(:plugin_settings) { {"manage_template" => true, "template_api" => 'composable'} }
|
104
|
+
let(:plugin) { LogStash::Outputs::ElasticSearch.new(plugin_settings) }
|
105
|
+
|
106
|
+
describe "in version 8+" do
|
107
|
+
it "should use legacy template API" do
|
108
|
+
expect(plugin).to receive(:maximum_seen_major_version).never
|
109
|
+
endpoint = described_class.template_endpoint(plugin)
|
110
|
+
expect(endpoint).to be_equal(LogStash::Outputs::ElasticSearch::TemplateManager:: INDEX_TEMPLATE_ENDPOINT)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
66
115
|
end
|
@@ -17,12 +17,17 @@ describe LogStash::Outputs::ElasticSearch do
|
|
17
17
|
allow_any_instance_of(LogStash::Outputs::ElasticSearch::HttpClient::Pool).to receive(:start)
|
18
18
|
end
|
19
19
|
|
20
|
+
let(:spy_http_client_builder!) do
|
21
|
+
allow(described_class::HttpClientBuilder).to receive(:build).with(any_args).and_call_original
|
22
|
+
end
|
23
|
+
|
20
24
|
let(:after_successful_connection_thread_mock) do
|
21
25
|
double('after_successful_connection_thread', value: true)
|
22
26
|
end
|
23
27
|
|
24
28
|
before(:each) do
|
25
29
|
if do_register
|
30
|
+
spy_http_client_builder!
|
26
31
|
stub_http_client_pool!
|
27
32
|
|
28
33
|
allow(subject).to receive(:finish_register) # stub-out thread completion (to avoid error log entries)
|
@@ -1003,29 +1008,88 @@ describe LogStash::Outputs::ElasticSearch do
|
|
1003
1008
|
let(:api_key) { "some_id:some_api_key" }
|
1004
1009
|
let(:base64_api_key) { "ApiKey c29tZV9pZDpzb21lX2FwaV9rZXk=" }
|
1005
1010
|
|
1006
|
-
|
1011
|
+
shared_examples 'secure api-key authenticated client' do
|
1012
|
+
let(:do_register) { true }
|
1013
|
+
|
1014
|
+
it 'adds the appropriate Authorization header to the manticore client' do
|
1015
|
+
expect(manticore_options[:headers]).to eq({ "Authorization" => base64_api_key })
|
1016
|
+
end
|
1017
|
+
it 'is provides ssl=>true to the http client builder' do; aggregate_failures do
|
1018
|
+
expect(described_class::HttpClientBuilder).to have_received(:build).with(anything, anything, hash_including('ssl'=>true))
|
1019
|
+
end; end
|
1020
|
+
end
|
1021
|
+
|
1022
|
+
context "when set without ssl => true" do
|
1007
1023
|
let(:do_register) { false } # this is what we want to test, so we disable the before(:each) call
|
1008
1024
|
let(:options) { { "api_key" => api_key } }
|
1009
1025
|
|
1010
1026
|
it "should raise a configuration error" do
|
1011
1027
|
expect { subject.register }.to raise_error LogStash::ConfigurationError, /requires SSL\/TLS/
|
1012
1028
|
end
|
1029
|
+
|
1030
|
+
context 'with cloud_id' do
|
1031
|
+
let(:sample_cloud_id) { 'sample:dXMtY2VudHJhbDEuZ2NwLmNsb3VkLmVzLmlvJGFjMzFlYmI5MDI0MTc3MzE1NzA0M2MzNGZkMjZmZDQ2OjkyNDMkYTRjMDYyMzBlNDhjOGZjZTdiZTg4YTA3NGEzYmIzZTA6OTI0NA==' }
|
1032
|
+
let(:options) { super().merge('cloud_id' => sample_cloud_id) }
|
1033
|
+
|
1034
|
+
it_behaves_like 'secure api-key authenticated client'
|
1035
|
+
end
|
1013
1036
|
end
|
1014
1037
|
|
1015
|
-
context "when set without ssl but with
|
1038
|
+
context "when set without ssl specified but with an https host" do
|
1016
1039
|
let(:do_register) { false } # this is what we want to test, so we disable the before(:each) call
|
1017
1040
|
let(:options) { { "hosts" => ["https://some.host.com"], "api_key" => api_key } }
|
1018
1041
|
|
1042
|
+
it_behaves_like 'secure api-key authenticated client'
|
1043
|
+
end
|
1044
|
+
|
1045
|
+
context "when set without ssl specified but with an http host`" do
|
1046
|
+
let(:do_register) { false } # this is what we want to test, so we disable the before(:each) call
|
1047
|
+
let(:options) { { "hosts" => ["http://some.host.com"], "api_key" => api_key } }
|
1048
|
+
|
1049
|
+
it "should raise a configuration error" do
|
1050
|
+
expect { subject.register }.to raise_error LogStash::ConfigurationError, /requires SSL\/TLS/
|
1051
|
+
end
|
1052
|
+
end
|
1053
|
+
|
1054
|
+
context "when set with `ssl => false`" do
|
1055
|
+
let(:do_register) { false } # this is what we want to test, so we disable the before(:each) call
|
1056
|
+
let(:options) { { "ssl" => "false", "api_key" => api_key } }
|
1057
|
+
|
1019
1058
|
it "should raise a configuration error" do
|
1020
1059
|
expect { subject.register }.to raise_error LogStash::ConfigurationError, /requires SSL\/TLS/
|
1021
1060
|
end
|
1022
1061
|
end
|
1023
1062
|
|
1024
1063
|
context "when set" do
|
1025
|
-
let(:options) { { "
|
1064
|
+
let(:options) { { "api_key" => ::LogStash::Util::Password.new(api_key) } }
|
1026
1065
|
|
1027
|
-
|
1028
|
-
|
1066
|
+
context "with ssl => true" do
|
1067
|
+
let(:options) { super().merge("ssl" => true) }
|
1068
|
+
it_behaves_like 'secure api-key authenticated client'
|
1069
|
+
end
|
1070
|
+
|
1071
|
+
context "with ssl => false" do
|
1072
|
+
let(:options) { super().merge("ssl" => "false") }
|
1073
|
+
|
1074
|
+
let(:do_register) { false } # this is what we want to test, so we disable the before(:each) call
|
1075
|
+
it "should raise a configuration error" do
|
1076
|
+
expect { subject.register }.to raise_error LogStash::ConfigurationError, /requires SSL\/TLS/
|
1077
|
+
end
|
1078
|
+
end
|
1079
|
+
|
1080
|
+
context "without ssl specified" do
|
1081
|
+
context "with an https host" do
|
1082
|
+
let(:options) { super().merge("hosts" => ["https://some.host.com"]) }
|
1083
|
+
it_behaves_like 'secure api-key authenticated client'
|
1084
|
+
end
|
1085
|
+
context "with an http host`" do
|
1086
|
+
let(:do_register) { false } # this is what we want to test, so we disable the before(:each) call
|
1087
|
+
let(:options) { { "hosts" => ["http://some.host.com"], "api_key" => api_key } }
|
1088
|
+
|
1089
|
+
it "should raise a configuration error" do
|
1090
|
+
expect { subject.register }.to raise_error LogStash::ConfigurationError, /requires SSL\/TLS/
|
1091
|
+
end
|
1092
|
+
end
|
1029
1093
|
end
|
1030
1094
|
end
|
1031
1095
|
|
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: 11.
|
4
|
+
version: 11.12.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|