logstash-output-elasticsearch 10.6.0-java → 10.8.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -1
- data/CONTRIBUTORS +1 -0
- data/docs/index.asciidoc +97 -78
- data/lib/logstash/outputs/elasticsearch.rb +300 -165
- data/lib/logstash/outputs/elasticsearch/http_client.rb +7 -2
- data/lib/logstash/outputs/elasticsearch/http_client/pool.rb +13 -28
- data/lib/logstash/outputs/elasticsearch/http_client_builder.rb +1 -0
- data/lib/logstash/outputs/elasticsearch/ilm.rb +9 -5
- data/lib/logstash/outputs/elasticsearch/license_checker.rb +47 -0
- data/lib/logstash/outputs/elasticsearch/template_manager.rb +8 -3
- data/lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-8x.json +39 -33
- data/lib/logstash/plugin_mixins/elasticsearch/api_configs.rb +163 -0
- data/lib/logstash/{outputs → plugin_mixins}/elasticsearch/common.rb +40 -154
- data/lib/logstash/plugin_mixins/elasticsearch/noop_license_checker.rb +9 -0
- data/logstash-output-elasticsearch.gemspec +1 -1
- data/spec/es_spec_helper.rb +32 -12
- data/spec/fixtures/template-with-policy-es8x.json +50 -0
- data/spec/integration/outputs/ilm_spec.rb +34 -20
- data/spec/integration/outputs/metrics_spec.rb +1 -5
- data/spec/unit/outputs/elasticsearch/http_client/pool_spec.rb +45 -5
- data/spec/unit/outputs/elasticsearch/http_client_spec.rb +22 -0
- data/spec/unit/outputs/elasticsearch/template_manager_spec.rb +31 -0
- data/spec/unit/outputs/elasticsearch_spec.rb +22 -0
- data/spec/unit/outputs/license_check_spec.rb +41 -0
- metadata +10 -4
- data/lib/logstash/outputs/elasticsearch/common_configs.rb +0 -167
@@ -1,7 +1,10 @@
|
|
1
1
|
require "logstash/outputs/elasticsearch/template_manager"
|
2
2
|
|
3
|
-
module LogStash; module
|
3
|
+
module LogStash; module PluginMixins; module ElasticSearch
|
4
4
|
module Common
|
5
|
+
|
6
|
+
# This module defines common methods that can be reused by alternate elasticsearch output plugins such as the elasticsearch_data_streams output.
|
7
|
+
|
5
8
|
attr_reader :client, :hosts
|
6
9
|
|
7
10
|
# These codes apply to documents, not at the request level
|
@@ -9,103 +12,26 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
9
12
|
DOC_SUCCESS_CODES = [200, 201]
|
10
13
|
DOC_CONFLICT_CODE = 409
|
11
14
|
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
#
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
# Receive an array of events and immediately attempt to index them (no buffering)
|
32
|
-
def multi_receive(events)
|
33
|
-
until @template_installed.true?
|
34
|
-
sleep 1
|
35
|
-
end
|
36
|
-
retrying_submit(events.map {|e| event_action_tuple(e)})
|
37
|
-
end
|
38
|
-
|
39
|
-
def setup_after_successful_connection
|
40
|
-
@template_installer ||= Thread.new do
|
41
|
-
sleep_interval = @retry_initial_interval
|
42
|
-
until successful_connection? || @stopping.true?
|
43
|
-
@logger.debug("Waiting for connectivity to Elasticsearch cluster. Retrying in #{sleep_interval}s")
|
44
|
-
Stud.stoppable_sleep(sleep_interval) { @stopping.true? }
|
45
|
-
sleep_interval = next_sleep_interval(sleep_interval)
|
46
|
-
end
|
47
|
-
if successful_connection?
|
48
|
-
discover_cluster_uuid
|
49
|
-
install_template
|
50
|
-
setup_ilm if ilm_in_use?
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def stop_template_installer
|
56
|
-
@template_installer.join unless @template_installer.nil?
|
57
|
-
end
|
58
|
-
|
59
|
-
def successful_connection?
|
60
|
-
!!maximum_seen_major_version
|
61
|
-
end
|
62
|
-
|
63
|
-
def use_event_type?
|
64
|
-
maximum_seen_major_version < 8
|
65
|
-
end
|
66
|
-
|
67
|
-
# Convert the event into a 3-tuple of action, params, and event
|
68
|
-
def event_action_tuple(event)
|
69
|
-
action = event.sprintf(@action)
|
70
|
-
|
71
|
-
params = {
|
72
|
-
:_id => @document_id ? event.sprintf(@document_id) : nil,
|
73
|
-
:_index => event.sprintf(@index),
|
74
|
-
routing_field_name => @routing ? event.sprintf(@routing) : nil
|
75
|
-
}
|
76
|
-
|
77
|
-
params[:_type] = get_event_type(event) if use_event_type?
|
78
|
-
|
79
|
-
if @pipeline
|
80
|
-
params[:pipeline] = event.sprintf(@pipeline)
|
81
|
-
end
|
82
|
-
|
83
|
-
if @parent
|
84
|
-
if @join_field
|
85
|
-
join_value = event.get(@join_field)
|
86
|
-
parent_value = event.sprintf(@parent)
|
87
|
-
event.set(@join_field, { "name" => join_value, "parent" => parent_value })
|
88
|
-
params[routing_field_name] = event.sprintf(@parent)
|
89
|
-
else
|
90
|
-
params[:parent] = event.sprintf(@parent)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
if action == 'update'
|
95
|
-
params[:_upsert] = LogStash::Json.load(event.sprintf(@upsert)) if @upsert != ""
|
96
|
-
params[:_script] = event.sprintf(@script) if @script != ""
|
97
|
-
params[retry_on_conflict_action_name] = @retry_on_conflict
|
98
|
-
end
|
99
|
-
|
100
|
-
if @version
|
101
|
-
params[:version] = event.sprintf(@version)
|
102
|
-
end
|
103
|
-
|
104
|
-
if @version_type
|
105
|
-
params[:version_type] = event.sprintf(@version_type)
|
15
|
+
# Perform some ES options validations and Build the HttpClient.
|
16
|
+
# Note that this methods may sets the @user, @password, @hosts and @client ivars as a side effect.
|
17
|
+
# @param license_checker [#appropriate_license?] An optional license checker that will be used by the Pool class.
|
18
|
+
# @return [HttpClient] the new http client
|
19
|
+
def build_client(license_checker = nil)
|
20
|
+
params["license_checker"] = license_checker
|
21
|
+
|
22
|
+
# the following 3 options validation & setup methods are called inside build_client
|
23
|
+
# because they must be executed prior to building the client and logstash
|
24
|
+
# monitoring and management rely on directly calling build_client
|
25
|
+
# see https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/934#pullrequestreview-396203307
|
26
|
+
validate_authentication
|
27
|
+
fill_hosts_from_cloud_id
|
28
|
+
setup_hosts
|
29
|
+
|
30
|
+
params["metric"] = metric
|
31
|
+
if @proxy.eql?('')
|
32
|
+
@logger.warn "Supplied proxy setting (proxy => '') has no effect"
|
106
33
|
end
|
107
|
-
|
108
|
-
[action, params, event]
|
34
|
+
@client ||= ::LogStash::Outputs::ElasticSearch::HttpClientBuilder.build(@logger, @hosts, params)
|
109
35
|
end
|
110
36
|
|
111
37
|
def validate_authentication
|
@@ -140,7 +66,7 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
140
66
|
|
141
67
|
def hosts_default?(hosts)
|
142
68
|
# NOTE: would be nice if pipeline allowed us a clean way to detect a config default :
|
143
|
-
hosts.is_a?(Array) && hosts.size == 1 && hosts.first.equal?(
|
69
|
+
hosts.is_a?(Array) && hosts.size == 1 && hosts.first.equal?(LogStash::PluginMixins::ElasticSearch::APIConfigs::DEFAULT_HOST)
|
144
70
|
end
|
145
71
|
private :hosts_default?
|
146
72
|
|
@@ -193,17 +119,23 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
193
119
|
client.maximum_seen_major_version
|
194
120
|
end
|
195
121
|
|
196
|
-
def
|
197
|
-
maximum_seen_major_version
|
198
|
-
end
|
199
|
-
|
200
|
-
def retry_on_conflict_action_name
|
201
|
-
maximum_seen_major_version >= 7 ? :retry_on_conflict : :_retry_on_conflict
|
122
|
+
def successful_connection?
|
123
|
+
!!maximum_seen_major_version
|
202
124
|
end
|
203
125
|
|
204
|
-
|
205
|
-
|
206
|
-
|
126
|
+
# launch a thread that waits for an initial successful connection to the ES cluster to call the given block
|
127
|
+
# @param block [Proc] the block to execute upon initial successful connection
|
128
|
+
# @return [Thread] the successful connection wait thread
|
129
|
+
def setup_after_successful_connection(&block)
|
130
|
+
Thread.new do
|
131
|
+
sleep_interval = @retry_initial_interval
|
132
|
+
until successful_connection? || @stopping.true?
|
133
|
+
@logger.debug("Waiting for connectivity to Elasticsearch cluster. Retrying in #{sleep_interval}s")
|
134
|
+
Stud.stoppable_sleep(sleep_interval) { @stopping.true? }
|
135
|
+
sleep_interval = next_sleep_interval(sleep_interval)
|
136
|
+
end
|
137
|
+
block.call if successful_connection?
|
138
|
+
end
|
207
139
|
end
|
208
140
|
|
209
141
|
def discover_cluster_uuid
|
@@ -215,22 +147,6 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
215
147
|
# @logger.error("Unable to retrieve elasticsearch cluster uuid", error => e.message)
|
216
148
|
end
|
217
149
|
|
218
|
-
def check_action_validity
|
219
|
-
raise LogStash::ConfigurationError, "No action specified!" unless @action
|
220
|
-
|
221
|
-
# If we're using string interpolation, we're good!
|
222
|
-
return if @action =~ /%{.+}/
|
223
|
-
return if valid_actions.include?(@action)
|
224
|
-
|
225
|
-
raise LogStash::ConfigurationError, "Action '#{@action}' is invalid! Pick one of #{valid_actions} or use a sprintf style statement"
|
226
|
-
end
|
227
|
-
|
228
|
-
# To be overidden by the -java version
|
229
|
-
VALID_HTTP_ACTIONS=["index", "delete", "create", "update"]
|
230
|
-
def valid_actions
|
231
|
-
VALID_HTTP_ACTIONS
|
232
|
-
end
|
233
|
-
|
234
150
|
def retrying_submit(actions)
|
235
151
|
# Initially we submit the full list of actions
|
236
152
|
submit_actions = actions
|
@@ -339,32 +255,6 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
339
255
|
end
|
340
256
|
end
|
341
257
|
|
342
|
-
# Determine the correct value for the 'type' field for the given event
|
343
|
-
DEFAULT_EVENT_TYPE_ES6="doc".freeze
|
344
|
-
DEFAULT_EVENT_TYPE_ES7="_doc".freeze
|
345
|
-
def get_event_type(event)
|
346
|
-
# Set the 'type' value for the index.
|
347
|
-
type = if @document_type
|
348
|
-
event.sprintf(@document_type)
|
349
|
-
else
|
350
|
-
if maximum_seen_major_version < 6
|
351
|
-
event.get("type") || DEFAULT_EVENT_TYPE_ES6
|
352
|
-
elsif maximum_seen_major_version == 6
|
353
|
-
DEFAULT_EVENT_TYPE_ES6
|
354
|
-
elsif maximum_seen_major_version == 7
|
355
|
-
DEFAULT_EVENT_TYPE_ES7
|
356
|
-
else
|
357
|
-
nil
|
358
|
-
end
|
359
|
-
end
|
360
|
-
|
361
|
-
if !(type.is_a?(String) || type.is_a?(Numeric))
|
362
|
-
@logger.warn("Bad event type! Non-string/integer type value set!", :type_class => type.class, :type_value => type.to_s, :event => event)
|
363
|
-
end
|
364
|
-
|
365
|
-
type.to_s
|
366
|
-
end
|
367
|
-
|
368
258
|
# Rescue retryable errors during bulk submission
|
369
259
|
def safe_bulk(actions)
|
370
260
|
sleep_interval = @retry_initial_interval
|
@@ -435,10 +325,6 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
435
325
|
end
|
436
326
|
end
|
437
327
|
|
438
|
-
def default_index?(index)
|
439
|
-
@index == @default_index
|
440
|
-
end
|
441
|
-
|
442
328
|
def dlq_enabled?
|
443
329
|
# TODO there should be a better way to query if DLQ is enabled
|
444
330
|
# See more in: https://github.com/elastic/logstash/issues/8064
|
@@ -446,4 +332,4 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
446
332
|
!execution_context.dlq_writer.inner_writer.is_a?(::LogStash::Util::DummyDeadLetterQueueWriter)
|
447
333
|
end
|
448
334
|
end
|
449
|
-
end end end
|
335
|
+
end; end; end
|
data/spec/es_spec_helper.rb
CHANGED
@@ -49,19 +49,10 @@ module ESHelper
|
|
49
49
|
Time.now.strftime("%Y.%m.%d")
|
50
50
|
end
|
51
51
|
|
52
|
-
|
53
|
-
def default_mapping_from_mappings(mappings)
|
54
|
-
if ESHelper.es_version_satisfies?(">=7")
|
55
|
-
mappings
|
56
|
-
else
|
57
|
-
mappings["_default_"]
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
52
|
def field_properties_from_template(template_name, field)
|
62
|
-
|
63
|
-
|
64
|
-
|
53
|
+
template = get_template(@es, template_name)
|
54
|
+
mappings = get_template_mappings(template)
|
55
|
+
mappings["properties"][field]["properties"]
|
65
56
|
end
|
66
57
|
|
67
58
|
def routing_field_name
|
@@ -105,6 +96,7 @@ module ESHelper
|
|
105
96
|
|
106
97
|
def clean(client)
|
107
98
|
client.indices.delete_template(:name => "*")
|
99
|
+
client.indices.delete_index_template(:name => "logstash*") rescue nil
|
108
100
|
# This can fail if there are no indexes, ignore failure.
|
109
101
|
client.indices.delete(:index => "*") rescue nil
|
110
102
|
clean_ilm(client) if supports_ilm?(client)
|
@@ -182,6 +174,34 @@ module ESHelper
|
|
182
174
|
}
|
183
175
|
}
|
184
176
|
end
|
177
|
+
|
178
|
+
def get_template(client, name)
|
179
|
+
if ESHelper.es_version_satisfies?(">=8")
|
180
|
+
t = client.indices.get_index_template(name: name)
|
181
|
+
t['index_templates'][0]['index_template']
|
182
|
+
else
|
183
|
+
t = client.indices.get_template(name: name)
|
184
|
+
t[name]
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def get_template_settings(template)
|
189
|
+
if ESHelper.es_version_satisfies?(">=8")
|
190
|
+
template['template']['settings']
|
191
|
+
else
|
192
|
+
template['settings']
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
def get_template_mappings(template)
|
197
|
+
if ESHelper.es_version_satisfies?(">=8")
|
198
|
+
template['template']['mappings']
|
199
|
+
elsif ESHelper.es_version_satisfies?(">=7")
|
200
|
+
template['mappings']
|
201
|
+
else
|
202
|
+
template['mappings']["_default_"]
|
203
|
+
end
|
204
|
+
end
|
185
205
|
end
|
186
206
|
|
187
207
|
RSpec.configure do |config|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
{
|
2
|
+
"index_patterns" : "overwrite-*",
|
3
|
+
"version" : 80001,
|
4
|
+
"template" : {
|
5
|
+
"settings" : {
|
6
|
+
"index.refresh_interval" : "1s",
|
7
|
+
"number_of_shards": 1
|
8
|
+
},
|
9
|
+
"mappings" : {
|
10
|
+
"dynamic_templates" : [ {
|
11
|
+
"message_field" : {
|
12
|
+
"path_match" : "message",
|
13
|
+
"match_mapping_type" : "string",
|
14
|
+
"mapping" : {
|
15
|
+
"type" : "text",
|
16
|
+
"norms" : false
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}, {
|
20
|
+
"string_fields" : {
|
21
|
+
"match" : "*",
|
22
|
+
"match_mapping_type" : "string",
|
23
|
+
"mapping" : {
|
24
|
+
"type" : "text", "norms" : false,
|
25
|
+
"fields" : {
|
26
|
+
"keyword" : { "type": "keyword", "ignore_above": 256 }
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
} ],
|
31
|
+
"properties" : {
|
32
|
+
"@timestamp": { "type": "date" },
|
33
|
+
"@version": { "type": "keyword" },
|
34
|
+
"geoip" : {
|
35
|
+
"dynamic": true,
|
36
|
+
"properties" : {
|
37
|
+
"ip": { "type": "ip" },
|
38
|
+
"location" : { "type" : "geo_point" },
|
39
|
+
"latitude" : { "type" : "half_float" },
|
40
|
+
"longitude" : { "type" : "half_float" }
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
},
|
46
|
+
"priority": 200,
|
47
|
+
"_meta" : {
|
48
|
+
"description": "index template for logstash-output-elasticsearch"
|
49
|
+
}
|
50
|
+
}
|
@@ -8,7 +8,7 @@ shared_examples_for 'an ILM enabled Logstash' do
|
|
8
8
|
let (:settings) { super.merge("ilm_policy" => ilm_policy_name)}
|
9
9
|
|
10
10
|
it 'should rollover when the policy max docs is reached' do
|
11
|
-
put_policy(@es,ilm_policy_name, policy)
|
11
|
+
put_policy(@es, ilm_policy_name, policy)
|
12
12
|
subject.register
|
13
13
|
|
14
14
|
subject.multi_receive([
|
@@ -108,9 +108,11 @@ shared_examples_for 'an ILM disabled Logstash' do
|
|
108
108
|
it 'should not write the ILM settings into the template' do
|
109
109
|
subject.register
|
110
110
|
sleep(1)
|
111
|
-
|
111
|
+
|
112
|
+
template = get_template(@es, "logstash")
|
113
|
+
expect(template).to have_index_pattern("logstash-*")
|
112
114
|
if ESHelper.es_version_satisfies?(">= 2")
|
113
|
-
expect(
|
115
|
+
expect(get_template_settings(template)['index']['lifecycle']).to be_nil
|
114
116
|
end
|
115
117
|
end
|
116
118
|
|
@@ -152,16 +154,17 @@ shared_examples_for 'an ILM disabled Logstash' do
|
|
152
154
|
end
|
153
155
|
|
154
156
|
context 'with a custom template name' do
|
155
|
-
let (:template_name) { "
|
157
|
+
let (:template_name) { "logstash_custom_template_name" }
|
156
158
|
let (:settings) { super.merge('template_name' => template_name)}
|
157
159
|
|
158
160
|
it 'should not write the ILM settings into the template' do
|
159
161
|
subject.register
|
160
162
|
sleep(1)
|
161
163
|
|
162
|
-
|
164
|
+
template = get_template(@es, template_name)
|
165
|
+
expect(template).to have_index_pattern("logstash-*")
|
163
166
|
if ESHelper.es_version_satisfies?(">= 2")
|
164
|
-
expect(
|
167
|
+
expect(get_template_settings(template)['index']['lifecycle']).to be_nil
|
165
168
|
end
|
166
169
|
end
|
167
170
|
end
|
@@ -387,16 +390,20 @@ if ESHelper.es_version_satisfies?(">= 6.6")
|
|
387
390
|
it 'should write the ILM settings into the template' do
|
388
391
|
subject.register
|
389
392
|
sleep(1)
|
390
|
-
|
391
|
-
|
392
|
-
expect(
|
393
|
+
|
394
|
+
template = get_template(@es, "logstash")
|
395
|
+
expect(template).to have_index_pattern("logstash-*")
|
396
|
+
expect(get_template_settings(template)['index']['lifecycle']['name']).to eq("logstash-policy")
|
397
|
+
expect(get_template_settings(template)['index']['lifecycle']['rollover_alias']).to eq("logstash")
|
393
398
|
end
|
394
399
|
|
395
400
|
it_behaves_like 'an ILM enabled Logstash'
|
396
401
|
end
|
397
402
|
|
398
403
|
context 'with a set index and a custom index pattern' do
|
399
|
-
if ESHelper.es_version_satisfies?(">=
|
404
|
+
if ESHelper.es_version_satisfies?(">= 8.0")
|
405
|
+
let (:template) { "spec/fixtures/template-with-policy-es8x.json" }
|
406
|
+
elsif ESHelper.es_version_satisfies?(">= 7.0")
|
400
407
|
let (:template) { "spec/fixtures/template-with-policy-es7x.json" }
|
401
408
|
else
|
402
409
|
let (:template) { "spec/fixtures/template-with-policy-es6x.json" }
|
@@ -408,13 +415,15 @@ if ESHelper.es_version_satisfies?(">= 6.6")
|
|
408
415
|
it 'should not overwrite the index patterns' do
|
409
416
|
subject.register
|
410
417
|
sleep(1)
|
411
|
-
|
418
|
+
|
419
|
+
template = get_template(@es, "logstash")
|
420
|
+
expect(template).to have_index_pattern("overwrite-*")
|
412
421
|
end
|
413
422
|
end
|
414
423
|
|
415
424
|
|
416
425
|
context 'with a custom template' do
|
417
|
-
let (:ilm_rollover_alias) { "
|
426
|
+
let (:ilm_rollover_alias) { "logstash_the_cat_in_the_hat" }
|
418
427
|
let (:index) { ilm_rollover_alias }
|
419
428
|
let(:expected_index) { index }
|
420
429
|
let (:settings) { super.merge("ilm_policy" => ilm_policy_name,
|
@@ -422,7 +431,9 @@ if ESHelper.es_version_satisfies?(">= 6.6")
|
|
422
431
|
"ilm_rollover_alias" => ilm_rollover_alias)}
|
423
432
|
|
424
433
|
|
425
|
-
if ESHelper.es_version_satisfies?(">=
|
434
|
+
if ESHelper.es_version_satisfies?(">= 8.0")
|
435
|
+
let (:template) { "spec/fixtures/template-with-policy-es8x.json" }
|
436
|
+
elsif ESHelper.es_version_satisfies?(">= 7.0")
|
426
437
|
let (:template) { "spec/fixtures/template-with-policy-es7x.json" }
|
427
438
|
else
|
428
439
|
let (:template) { "spec/fixtures/template-with-policy-es6x.json" }
|
@@ -460,13 +471,15 @@ if ESHelper.es_version_satisfies?(">= 6.6")
|
|
460
471
|
it 'should write the ILM settings into the template' do
|
461
472
|
subject.register
|
462
473
|
sleep(1)
|
463
|
-
|
464
|
-
|
465
|
-
expect(
|
474
|
+
|
475
|
+
template = get_template(@es, ilm_rollover_alias)
|
476
|
+
expect(template).to have_index_pattern("#{ilm_rollover_alias}-*")
|
477
|
+
expect(get_template_settings(template)['index']['lifecycle']['name']).to eq(ilm_policy_name)
|
478
|
+
expect(get_template_settings(template)['index']['lifecycle']['rollover_alias']).to eq(ilm_rollover_alias)
|
466
479
|
end
|
467
480
|
|
468
481
|
context 'with a different template_name' do
|
469
|
-
let (:template_name) { "
|
482
|
+
let (:template_name) { "logstash_custom_template_name" }
|
470
483
|
let (:settings) { super.merge('template_name' => template_name)}
|
471
484
|
|
472
485
|
it_behaves_like 'an ILM enabled Logstash'
|
@@ -474,9 +487,10 @@ if ESHelper.es_version_satisfies?(">= 6.6")
|
|
474
487
|
it 'should write the ILM settings into the template' do
|
475
488
|
subject.register
|
476
489
|
sleep(1)
|
477
|
-
|
478
|
-
expect(
|
479
|
-
expect(
|
490
|
+
template = get_template(@es, template_name)
|
491
|
+
expect(template).to have_index_pattern("#{ilm_rollover_alias}-*")
|
492
|
+
expect(get_template_settings(template)['index']['lifecycle']['name']).to eq(ilm_policy_name)
|
493
|
+
expect(get_template_settings(template)['index']['lifecycle']['rollover_alias']).to eq(ilm_rollover_alias)
|
480
494
|
end
|
481
495
|
end
|
482
496
|
|