fluent-plugin-elasticsearch 4.2.1 → 4.3.3
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/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +24 -0
- data/.github/workflows/issue-auto-closer.yml +1 -1
- data/History.md +22 -0
- data/README.ElasticsearchGenID.md +2 -2
- data/README.md +39 -2
- data/fluent-plugin-elasticsearch.gemspec +1 -1
- data/lib/fluent/plugin/elasticsearch_index_template.rb +15 -11
- data/lib/fluent/plugin/out_elasticsearch.rb +47 -15
- data/test/plugin/test_elasticsearch_fallback_selector.rb +1 -0
- data/test/plugin/test_elasticsearch_index_lifecycle_management.rb +3 -0
- data/test/plugin/test_out_elasticsearch.rb +445 -28
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed7efe8849b8a7ca1d2cc3c81444e604c0bda824209f9297f0114f01c1ba609a
|
4
|
+
data.tar.gz: f74f8726fa993c3e4bc01b742e97ef4579fb7335809aac2dabce03c2b002e9ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6adeee82a86f8217f9e6d259990042330d8a96a3a3ddb03a332a90f4ce90996c99aff7385b05c625eee4c6253b9647ba2bfc7856f51ba306ef7df6917d716fb4
|
7
|
+
data.tar.gz: dec1a1a72c88c2fd4df38e1b57ca883d47c5f28582fb5ba9a9210c882986c5e52a44f4eda03bef708961b461555b1538968b905b346e6782ad1090ca4310747d
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
name: Bug Report
|
3
|
+
about: Create a report to help us improve. If you have questions about ES plugin on kubernetes, please direct these to https://discuss.kubernetes.io/ before sumbit kubernetes related issue.
|
4
|
+
|
5
|
+
---
|
6
|
+
|
7
|
+
(check apply)
|
8
|
+
- [ ] read [the contribution guideline](https://github.com/uken/fluent-plugin-elasticsearch/blob/master/CONTRIBUTING.md)
|
9
|
+
- [ ] (optional) already reported 3rd party upstream repository or mailing list if you use k8s addon or helm charts.
|
10
|
+
|
11
|
+
#### Problem
|
12
|
+
|
13
|
+
...
|
14
|
+
|
15
|
+
#### Steps to replicate
|
16
|
+
|
17
|
+
Either clone and modify https://gist.github.com/pitr/9a518e840db58f435911
|
18
|
+
|
19
|
+
**OR**
|
20
|
+
|
21
|
+
Provide example config and message
|
22
|
+
|
23
|
+
#### Expected Behavior or What you need to ask
|
24
|
+
|
25
|
+
...
|
26
|
+
|
27
|
+
#### Using Fluentd and ES plugin versions
|
28
|
+
|
29
|
+
* OS version
|
30
|
+
* Bare Metal or within Docker or Kubernetes or others?
|
31
|
+
* Fluentd v0.12 or v0.14/v1.0
|
32
|
+
* paste result of ``fluentd --version`` or ``td-agent --version``
|
33
|
+
* ES plugin 3.x.y/2.x.y or 1.x.y
|
34
|
+
* paste boot log of fluentd or td-agent
|
35
|
+
* paste result of ``fluent-gem list``, ``td-agent-gem list`` or your Gemfile.lock
|
36
|
+
* ES version (optional)
|
37
|
+
* ES template(s) (optional)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
name: Feature request
|
3
|
+
about: Suggest an idea for this project
|
4
|
+
|
5
|
+
---
|
6
|
+
|
7
|
+
(check apply)
|
8
|
+
- [ ] read [the contribution guideline](https://github.com/uken/fluent-plugin-elasticsearch/blob/master/CONTRIBUTING.md)
|
9
|
+
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
11
|
+
|
12
|
+
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
|
13
|
+
|
14
|
+
**Describe the solution you'd like**
|
15
|
+
|
16
|
+
<!-- A clear and concise description of what you want to happen. -->
|
17
|
+
|
18
|
+
**Describe alternatives you've considered**
|
19
|
+
|
20
|
+
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
|
21
|
+
|
22
|
+
**Additional context**
|
23
|
+
|
24
|
+
<!-- Add any other context or screenshots about the feature request here. -->
|
@@ -9,4 +9,4 @@ jobs:
|
|
9
9
|
with:
|
10
10
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
11
11
|
issue-close-message: "@${issue.user.login} this issue was automatically closed because it did not follow the issue template."
|
12
|
-
issue-pattern: "(.*Problem.*)|(.*Expected Behavior or What you need to ask.*)|(.*Using Fluentd and ES plugin versions.*)"
|
12
|
+
issue-pattern: "(.*Problem.*)|(.*Expected Behavior or What you need to ask.*)|(.*Using Fluentd and ES plugin versions.*)|(.*Is your feature request related to a problem? Please describe.*)|(.*Describe the solution you'd like.*)|(.*Describe alternatives you've considered.*)"
|
data/History.md
CHANGED
@@ -2,6 +2,28 @@
|
|
2
2
|
|
3
3
|
### [Unreleased]
|
4
4
|
|
5
|
+
### 4.3.3
|
6
|
+
- Handle invalid Elasticsearch::Client#info response (#855)
|
7
|
+
|
8
|
+
### 4.3.2
|
9
|
+
- Use log.debug to dump ES 8.x _type information (#852)
|
10
|
+
|
11
|
+
### 4.3.1
|
12
|
+
- Unsplit huge records by default (#851)
|
13
|
+
|
14
|
+
### 4.3.0
|
15
|
+
- Add cloud_id & cloud_auth settings (#850)
|
16
|
+
- Fix failing tests on es6 client (#848)
|
17
|
+
- feat: retry on transport errors (#846)
|
18
|
+
- fix typo (#838)
|
19
|
+
- Remove unnecessary nil check (#826)
|
20
|
+
|
21
|
+
### 4.2.2
|
22
|
+
- Remove unnecessary nil check (#826)
|
23
|
+
- Fix ILM rollover index template pattern to apply index_separator (#825)
|
24
|
+
- Fix ILM rollover alias creation when a placeholder is used in index_name (#823)
|
25
|
+
- Add a note about the pitfalls of per-date indexes used with ILM (#822)
|
26
|
+
|
5
27
|
### 4.2.1
|
6
28
|
- Update a broken link (#821)
|
7
29
|
- Include chunk_id in records (#820)
|
@@ -17,7 +17,7 @@
|
|
17
17
|
In your Fluentd configuration, use `@type elasticsearch_genid`. Additional configuration is optional, default values would look like this:
|
18
18
|
|
19
19
|
```
|
20
|
-
<
|
20
|
+
<filter>
|
21
21
|
@type elasticsearch_genid
|
22
22
|
hash_id_key _hash
|
23
23
|
include_tag_in_seed false
|
@@ -27,7 +27,7 @@ In your Fluentd configuration, use `@type elasticsearch_genid`. Additional confi
|
|
27
27
|
record_keys []
|
28
28
|
separator _
|
29
29
|
hash_type sha1
|
30
|
-
</
|
30
|
+
</filter>
|
31
31
|
```
|
32
32
|
|
33
33
|
## Configuration
|
data/README.md
CHANGED
@@ -19,6 +19,8 @@ Current maintainers: @cosmo0920
|
|
19
19
|
* [Configuration](#configuration)
|
20
20
|
+ [host](#host)
|
21
21
|
+ [port](#port)
|
22
|
+
+ [cloud_id](#cloud_id)
|
23
|
+
+ [cloud_auth](#cloud_auth)
|
22
24
|
+ [emit_error_for_missing_id](#emit_error_for_missing_id)
|
23
25
|
+ [hosts](#hosts)
|
24
26
|
+ [user, password, path, scheme, ssl_verify](#user-password-path-scheme-ssl_verify)
|
@@ -187,6 +189,26 @@ port 9201 # defaults to 9200
|
|
187
189
|
|
188
190
|
You can specify Elasticsearch port by this parameter.
|
189
191
|
|
192
|
+
### cloud_id
|
193
|
+
|
194
|
+
```
|
195
|
+
cloud_id test-dep:ZXVyb3BlLXdlc3QxLmdjcC5jbG91ZC5lcy5pbyRiYZTA1Ng==
|
196
|
+
```
|
197
|
+
|
198
|
+
You can specify Elasticsearch cloud_id by this parameter.
|
199
|
+
|
200
|
+
If you specify `cloud_id` option then `cloud_auth` option is required.
|
201
|
+
If you specify `cloud_id` option, `host`, `port`, `user` and `password` options are ignored.
|
202
|
+
|
203
|
+
### cloud_auth
|
204
|
+
|
205
|
+
```
|
206
|
+
cloud_auth 'elastic:slkjdaooewkd87iqQ2O8EQYV'
|
207
|
+
```
|
208
|
+
|
209
|
+
You can specify Elasticsearch cloud_auth by this parameter.
|
210
|
+
|
211
|
+
|
190
212
|
### emit_error_for_missing_id
|
191
213
|
|
192
214
|
```
|
@@ -501,7 +523,7 @@ Specify the application name for the rollover index to be created.
|
|
501
523
|
application_name default # defaults to "default"
|
502
524
|
```
|
503
525
|
|
504
|
-
If [enable_ilm](#enable_ilm is set, then this parameter will be in effect otherwise ignored.
|
526
|
+
If [enable_ilm](#enable_ilm) is set, then this parameter will be in effect otherwise ignored.
|
505
527
|
|
506
528
|
### template_overwrite
|
507
529
|
|
@@ -1143,6 +1165,8 @@ And yet another option is described in Dynamic Configuration section.
|
|
1143
1165
|
|
1144
1166
|
### Dynamic configuration
|
1145
1167
|
|
1168
|
+
**NOTE**: *`out_elasticsearch_dynamic` will be planned to be marked as deprecated.* Please don't use the new Fluentd configuration. This plugin is maintained for backward compatibility.
|
1169
|
+
|
1146
1170
|
If you want configurations to depend on information in messages, you can use `elasticsearch_dynamic`. This is an experimental variation of the Elasticsearch plugin allows configuration values to be specified in ways such as the below:
|
1147
1171
|
|
1148
1172
|
```
|
@@ -1255,7 +1279,7 @@ Default value is `true`.
|
|
1255
1279
|
|
1256
1280
|
Configure `bulk_message` request splitting threshold size.
|
1257
1281
|
|
1258
|
-
Default value is `
|
1282
|
+
Default value is `-1`(unlimited).
|
1259
1283
|
|
1260
1284
|
If you specify this size as negative number, `bulk_message` request splitting feature will be disabled.
|
1261
1285
|
|
@@ -1881,6 +1905,16 @@ template_name your-fluentd-template
|
|
1881
1905
|
template_file /path/to/fluentd-template.json
|
1882
1906
|
```
|
1883
1907
|
|
1908
|
+
Note that if you create a new set of indexes every day, the elasticsearch ILM policy system will treat each day separately and will always
|
1909
|
+
maintain a separate active write index for each day.
|
1910
|
+
|
1911
|
+
If you have a rollover based on max_age, it will continue to roll the indexes for prior dates even if no new documents are indexed. If you want
|
1912
|
+
to delete indexes after a period of time, the ILM policy will never delete the current write index regardless of its age, so you would need a separate
|
1913
|
+
system, such as curator, to actually delete the old indexes.
|
1914
|
+
|
1915
|
+
For this reason, if you put the date into the index names with ILM you should only rollover based on size or number of documents and may need to use
|
1916
|
+
curator to actually delete old indexes.
|
1917
|
+
|
1884
1918
|
#### Fixed ILM indices
|
1885
1919
|
|
1886
1920
|
Also, users can use fixed ILM indices configuration.
|
@@ -1996,4 +2030,7 @@ Install dev dependencies:
|
|
1996
2030
|
$ gem install bundler
|
1997
2031
|
$ bundle install
|
1998
2032
|
$ bundle exec rake test
|
2033
|
+
# To just run the test you are working on:
|
2034
|
+
$ bundle exec rake test TEST=test/plugin/test_out_elasticsearch.rb TESTOPTS='--verbose --name=test_custom_template_with_rollover_index_create_and_custom_ilm'
|
2035
|
+
|
1999
2036
|
```
|
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'fluent-plugin-elasticsearch'
|
6
|
-
s.version = '4.
|
6
|
+
s.version = '4.3.3'
|
7
7
|
s.authors = ['diogo', 'pitr', 'Hiroshi Hatake']
|
8
8
|
s.email = ['pitr.vern@gmail.com', 'me@diogoterror.com', 'cosmo0920.wp@gmail.com']
|
9
9
|
s.description = %q{Elasticsearch output plugin for Fluent event collector}
|
@@ -32,12 +32,13 @@ module Fluent::ElasticsearchIndexTemplate
|
|
32
32
|
return false
|
33
33
|
end
|
34
34
|
|
35
|
-
def retry_operate(max_retries, fail_on_retry_exceed = true)
|
35
|
+
def retry_operate(max_retries, fail_on_retry_exceed = true, catch_trasport_exceptions = true)
|
36
36
|
return unless block_given?
|
37
37
|
retries = 0
|
38
|
+
transport_errors = Elasticsearch::Transport::Transport::Errors.constants.map{ |c| Elasticsearch::Transport::Transport::Errors.const_get c } if catch_trasport_exceptions
|
38
39
|
begin
|
39
40
|
yield
|
40
|
-
rescue *client.transport.host_unreachable_exceptions, Timeout::Error => e
|
41
|
+
rescue *client.transport.host_unreachable_exceptions, *transport_errors, Timeout::Error => e
|
41
42
|
@_es = nil
|
42
43
|
@_es_info = nil
|
43
44
|
if retries < max_retries
|
@@ -73,14 +74,15 @@ module Fluent::ElasticsearchIndexTemplate
|
|
73
74
|
end
|
74
75
|
end
|
75
76
|
|
76
|
-
def template_install(name, template_file, overwrite, enable_ilm = false, deflector_alias_name = nil, ilm_policy_id = nil, host = nil, target_index = nil)
|
77
|
+
def template_install(name, template_file, overwrite, enable_ilm = false, deflector_alias_name = nil, ilm_policy_id = nil, host = nil, target_index = nil, index_separator = '-')
|
77
78
|
inject_template_name = get_template_name(enable_ilm, name, deflector_alias_name)
|
78
79
|
if overwrite
|
79
80
|
template_put(inject_template_name,
|
80
81
|
enable_ilm ? inject_ilm_settings_to_template(deflector_alias_name,
|
81
82
|
target_index,
|
82
83
|
ilm_policy_id,
|
83
|
-
get_template(template_file)
|
84
|
+
get_template(template_file),
|
85
|
+
index_separator) :
|
84
86
|
get_template(template_file), host)
|
85
87
|
|
86
88
|
log.debug("Template '#{inject_template_name}' overwritten with #{template_file}.")
|
@@ -91,7 +93,8 @@ module Fluent::ElasticsearchIndexTemplate
|
|
91
93
|
enable_ilm ? inject_ilm_settings_to_template(deflector_alias_name,
|
92
94
|
target_index,
|
93
95
|
ilm_policy_id,
|
94
|
-
get_template(template_file)
|
96
|
+
get_template(template_file),
|
97
|
+
index_separator) :
|
95
98
|
get_template(template_file), host)
|
96
99
|
log.info("Template configured, but no template installed. Installed '#{inject_template_name}' from #{template_file}.")
|
97
100
|
else
|
@@ -99,14 +102,15 @@ module Fluent::ElasticsearchIndexTemplate
|
|
99
102
|
end
|
100
103
|
end
|
101
104
|
|
102
|
-
def template_custom_install(template_name, template_file, overwrite, customize_template, enable_ilm, deflector_alias_name, ilm_policy_id, host, target_index)
|
105
|
+
def template_custom_install(template_name, template_file, overwrite, customize_template, enable_ilm, deflector_alias_name, ilm_policy_id, host, target_index, index_separator)
|
103
106
|
template_custom_name = get_template_name(enable_ilm, template_name, deflector_alias_name)
|
104
107
|
custom_template = if enable_ilm
|
105
108
|
inject_ilm_settings_to_template(deflector_alias_name,
|
106
109
|
target_index,
|
107
110
|
ilm_policy_id,
|
108
111
|
get_custom_template(template_file,
|
109
|
-
customize_template)
|
112
|
+
customize_template),
|
113
|
+
index_separator)
|
110
114
|
else
|
111
115
|
get_custom_template(template_file, customize_template)
|
112
116
|
end
|
@@ -127,9 +131,9 @@ module Fluent::ElasticsearchIndexTemplate
|
|
127
131
|
enable_ilm ? deflector_alias_name : template_name
|
128
132
|
end
|
129
133
|
|
130
|
-
def inject_ilm_settings_to_template(deflector_alias, target_index, ilm_policy_id, template)
|
134
|
+
def inject_ilm_settings_to_template(deflector_alias, target_index, ilm_policy_id, template, index_separator)
|
131
135
|
log.debug("Overwriting index patterns when Index Lifecycle Management is enabled.")
|
132
|
-
template['index_patterns'] = "#{target_index}
|
136
|
+
template['index_patterns'] = "#{target_index}#{index_separator}*"
|
133
137
|
if @use_legacy_template
|
134
138
|
template.delete('template') if template.include?('template')
|
135
139
|
# Prepare settings Hash
|
@@ -140,7 +144,7 @@ module Fluent::ElasticsearchIndexTemplate
|
|
140
144
|
log.debug("Overwriting index lifecycle name and rollover alias when Index Lifecycle Management is enabled.")
|
141
145
|
end
|
142
146
|
template['settings'].update({ 'index.lifecycle.name' => ilm_policy_id, 'index.lifecycle.rollover_alias' => deflector_alias})
|
143
|
-
template['order'] = template['order'] ? template['order'] + target_index.
|
147
|
+
template['order'] = template['order'] ? template['order'] + target_index.count(index_separator) + 1 : 51 + target_index.count(index_separator)
|
144
148
|
else
|
145
149
|
# Prepare template.settings Hash
|
146
150
|
if !template['template'].key?('settings')
|
@@ -150,7 +154,7 @@ module Fluent::ElasticsearchIndexTemplate
|
|
150
154
|
log.debug("Overwriting index lifecycle name and rollover alias when Index Lifecycle Management is enabled.")
|
151
155
|
end
|
152
156
|
template['template']['settings'].update({ 'index.lifecycle.name' => ilm_policy_id, 'index.lifecycle.rollover_alias' => deflector_alias})
|
153
|
-
template['priority'] = template['priority'] ? template['priority'] + target_index.
|
157
|
+
template['priority'] = template['priority'] ? template['priority'] + target_index.count(index_separator) + 1 : 101 + target_index.count(index_separator)
|
154
158
|
end
|
155
159
|
template
|
156
160
|
end
|
@@ -77,6 +77,8 @@ module Fluent::Plugin
|
|
77
77
|
config_param :port, :integer, :default => 9200
|
78
78
|
config_param :user, :string, :default => nil
|
79
79
|
config_param :password, :string, :default => nil, :secret => true
|
80
|
+
config_param :cloud_id, :string, :default => nil
|
81
|
+
config_param :cloud_auth, :string, :default => nil
|
80
82
|
config_param :path, :string, :default => nil
|
81
83
|
config_param :scheme, :enum, :list => [:https, :http], :default => :http
|
82
84
|
config_param :hosts, :string, :default => nil
|
@@ -171,6 +173,7 @@ EOC
|
|
171
173
|
config_param :ilm_policy_overwrite, :bool, :default => false
|
172
174
|
config_param :truncate_caches_interval, :time, :default => nil
|
173
175
|
config_param :use_legacy_template, :bool, :default => true
|
176
|
+
config_param :catch_transport_exception_on_retry, :bool, :default => true
|
174
177
|
|
175
178
|
config_section :metadata, param_name: :metainfo, multi: false do
|
176
179
|
config_param :include_chunk_id, :bool, :default => false
|
@@ -259,9 +262,11 @@ EOC
|
|
259
262
|
template_installation_actual(@deflector_alias ? @deflector_alias : @index_name, @template_name, @customize_template, @application_name, @index_name, @ilm_policy_id)
|
260
263
|
end
|
261
264
|
verify_ilm_working if @enable_ilm
|
262
|
-
end
|
265
|
+
end
|
263
266
|
if @templates
|
264
|
-
retry_operate(@max_retry_putting_template,
|
267
|
+
retry_operate(@max_retry_putting_template,
|
268
|
+
@fail_on_putting_template_retry_exceed,
|
269
|
+
@catch_transport_exception_on_retry) do
|
265
270
|
templates_hash_install(@templates, @template_overwrite)
|
266
271
|
end
|
267
272
|
end
|
@@ -291,8 +296,14 @@ EOC
|
|
291
296
|
@dump_proc = Yajl.method(:dump)
|
292
297
|
end
|
293
298
|
|
299
|
+
raise Fluent::ConfigError, "`cloud_auth` must be present if `cloud_id` is present" if @cloud_id && @cloud_auth.nil?
|
294
300
|
raise Fluent::ConfigError, "`password` must be present if `user` is present" if @user && @password.nil?
|
295
301
|
|
302
|
+
if @cloud_auth
|
303
|
+
@user = @cloud_auth.split(':', -1)[0]
|
304
|
+
@password = @cloud_auth.split(':', -1)[1]
|
305
|
+
end
|
306
|
+
|
296
307
|
if @user && m = @user.match(/%{(?<user>.*)}/)
|
297
308
|
@user = URI.encode_www_form_component(m["user"])
|
298
309
|
end
|
@@ -338,7 +349,7 @@ EOC
|
|
338
349
|
@type_name = '_doc'.freeze
|
339
350
|
end
|
340
351
|
if @last_seen_major_version >= 8 && @type_name != DEFAULT_TYPE_NAME_ES_7x
|
341
|
-
log.
|
352
|
+
log.debug "Detected ES 8.x or above: This parameter has no effect."
|
342
353
|
@type_name = nil
|
343
354
|
end
|
344
355
|
end
|
@@ -470,7 +481,9 @@ EOC
|
|
470
481
|
|
471
482
|
def handle_last_seen_es_major_version
|
472
483
|
if @verify_es_version_at_startup && !dry_run?
|
473
|
-
retry_operate(@max_retry_get_es_version,
|
484
|
+
retry_operate(@max_retry_get_es_version,
|
485
|
+
@fail_on_detecting_es_version_retry_exceed,
|
486
|
+
@catch_transport_exception_on_retry) do
|
474
487
|
detect_es_major_version
|
475
488
|
end
|
476
489
|
else
|
@@ -480,7 +493,12 @@ EOC
|
|
480
493
|
|
481
494
|
def detect_es_major_version
|
482
495
|
@_es_info ||= client.info
|
483
|
-
|
496
|
+
begin
|
497
|
+
unless version = @_es_info.dig("version", "number")
|
498
|
+
version = @default_elasticsearch_version
|
499
|
+
end
|
500
|
+
rescue NoMethodError => e
|
501
|
+
log.warn "#{@_es_info} can not dig version information. Assuming Elasticsearch #{@default_elasticsearch_version}", error: e
|
484
502
|
version = @default_elasticsearch_version
|
485
503
|
end
|
486
504
|
version.to_i
|
@@ -555,7 +573,17 @@ EOC
|
|
555
573
|
return Time.at(event_time).to_datetime
|
556
574
|
end
|
557
575
|
|
576
|
+
def cloud_client
|
577
|
+
Elasticsearch::Client.new(
|
578
|
+
cloud_id: @cloud_id,
|
579
|
+
user: @user,
|
580
|
+
password: @password
|
581
|
+
)
|
582
|
+
end
|
583
|
+
|
558
584
|
def client(host = nil, compress_connection = false)
|
585
|
+
return cloud_client if @cloud_id
|
586
|
+
|
559
587
|
# check here to see if we already have a client connection for the given host
|
560
588
|
connection_options = get_connection_options(host)
|
561
589
|
|
@@ -907,7 +935,7 @@ EOC
|
|
907
935
|
log.warn "Detected ES 7.x: `_doc` will be used as the document `_type`."
|
908
936
|
target_type = '_doc'.freeze
|
909
937
|
elsif @last_seen_major_version >=8
|
910
|
-
log.
|
938
|
+
log.debug "Detected ES 8.x or above: document type will not be used."
|
911
939
|
target_type = nil
|
912
940
|
end
|
913
941
|
else
|
@@ -917,7 +945,7 @@ EOC
|
|
917
945
|
log.warn "Detected ES 7.x: `_doc` will be used as the document `_type`."
|
918
946
|
target_type = '_doc'.freeze
|
919
947
|
elsif @last_seen_major_version >= 8
|
920
|
-
log.
|
948
|
+
log.debug "Detected ES 8.x or above: document type will not be used."
|
921
949
|
target_type = nil
|
922
950
|
else
|
923
951
|
target_type = type_name
|
@@ -982,22 +1010,26 @@ EOC
|
|
982
1010
|
|
983
1011
|
def template_installation_actual(deflector_alias, template_name, customize_template, application_name, target_index, ilm_policy_id, host=nil)
|
984
1012
|
if template_name && @template_file
|
985
|
-
if !@logstash_format && @alias_indexes.include?
|
986
|
-
|
987
|
-
|
988
|
-
|
1013
|
+
if !@logstash_format && (deflector_alias.nil? || (@alias_indexes.include? deflector_alias)) && (@template_names.include? template_name)
|
1014
|
+
if deflector_alias
|
1015
|
+
log.debug("Index alias #{deflector_alias} and template #{template_name} already exist (cached)")
|
1016
|
+
else
|
1017
|
+
log.debug("Template #{template_name} already exists (cached)")
|
1018
|
+
end
|
989
1019
|
else
|
990
|
-
retry_operate(@max_retry_putting_template,
|
1020
|
+
retry_operate(@max_retry_putting_template,
|
1021
|
+
@fail_on_putting_template_retry_exceed,
|
1022
|
+
@catch_transport_exception_on_retry) do
|
991
1023
|
if customize_template
|
992
|
-
template_custom_install(template_name, @template_file, @template_overwrite, customize_template, @enable_ilm, deflector_alias, ilm_policy_id, host, target_index)
|
1024
|
+
template_custom_install(template_name, @template_file, @template_overwrite, customize_template, @enable_ilm, deflector_alias, ilm_policy_id, host, target_index, @index_separator)
|
993
1025
|
else
|
994
|
-
template_install(template_name, @template_file, @template_overwrite, @enable_ilm, deflector_alias, ilm_policy_id, host, target_index)
|
1026
|
+
template_install(template_name, @template_file, @template_overwrite, @enable_ilm, deflector_alias, ilm_policy_id, host, target_index, @index_separator)
|
995
1027
|
end
|
996
1028
|
ilm_policy = @ilm_policies[ilm_policy_id] || {}
|
997
1029
|
create_rollover_alias(target_index, @rollover_index, deflector_alias, application_name, @index_date_pattern, @index_separator, @enable_ilm, ilm_policy_id, ilm_policy, @ilm_policy_overwrite, host)
|
998
1030
|
end
|
999
1031
|
@alias_indexes << deflector_alias unless deflector_alias.nil?
|
1000
|
-
@template_names << template_name
|
1032
|
+
@template_names << template_name
|
1001
1033
|
end
|
1002
1034
|
end
|
1003
1035
|
end
|