fluent-plugin-elasticsearch 4.2.2 → 4.3.0
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 +7 -0
- data/README.ElasticsearchGenID.md +2 -2
- data/README.md +25 -1
- data/fluent-plugin-elasticsearch.gemspec +1 -1
- data/lib/fluent/plugin/elasticsearch_index_template.rb +3 -2
- data/lib/fluent/plugin/out_elasticsearch.rb +28 -3
- 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 +178 -0
- 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: 5aaeb8e93dcb477b3c2d83bc469cd327068aa59f9dc073e8578cea6320b5a4d4
|
|
4
|
+
data.tar.gz: 3b1f76ac44342ce51b53dce4d4b15be77744c21f130b6bd2cd5eee0de4dae4b2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8605eeb221ebf030b440865cb049b092ba3a5f57264226f22edacbdb07844301820a8d96e230a6593cdd29ec1fb0febb4f0aa8b7225ec80802f5f0f5b1a8a82a
|
|
7
|
+
data.tar.gz: dcc159325045a0609935c92b53085e564109bcc3d3eb75946226f0c5ac4d7899e79b9480aede76545378c6a0c6927ee92505f5c1aa1801b89d11fa857650964d
|
|
@@ -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,13 @@
|
|
|
2
2
|
|
|
3
3
|
### [Unreleased]
|
|
4
4
|
|
|
5
|
+
### 4.3.0
|
|
6
|
+
- Add cloud_id & cloud_auth settings (#850)
|
|
7
|
+
- Fix failing tests on es6 client (#848)
|
|
8
|
+
- feat: retry on transport errors (#846)
|
|
9
|
+
- fix typo (#838)
|
|
10
|
+
- Remove unnecessary nil check (#826)
|
|
11
|
+
|
|
5
12
|
### 4.2.2
|
|
6
13
|
- Remove unnecessary nil check (#826)
|
|
7
14
|
- Fix ILM rollover index template pattern to apply index_separator (#825)
|
|
@@ -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
|
```
|
|
@@ -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.0'
|
|
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
|
|
@@ -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
|
|
@@ -261,7 +264,9 @@ EOC
|
|
|
261
264
|
verify_ilm_working if @enable_ilm
|
|
262
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
|
|
@@ -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
|
|
@@ -555,7 +568,17 @@ EOC
|
|
|
555
568
|
return Time.at(event_time).to_datetime
|
|
556
569
|
end
|
|
557
570
|
|
|
571
|
+
def cloud_client
|
|
572
|
+
Elasticsearch::Client.new(
|
|
573
|
+
cloud_id: @cloud_id,
|
|
574
|
+
user: @user,
|
|
575
|
+
password: @password
|
|
576
|
+
)
|
|
577
|
+
end
|
|
578
|
+
|
|
558
579
|
def client(host = nil, compress_connection = false)
|
|
580
|
+
return cloud_client if @cloud_id
|
|
581
|
+
|
|
559
582
|
# check here to see if we already have a client connection for the given host
|
|
560
583
|
connection_options = get_connection_options(host)
|
|
561
584
|
|
|
@@ -989,7 +1012,9 @@ EOC
|
|
|
989
1012
|
log.debug("Template #{template_name} already exists (cached)")
|
|
990
1013
|
end
|
|
991
1014
|
else
|
|
992
|
-
retry_operate(@max_retry_putting_template,
|
|
1015
|
+
retry_operate(@max_retry_putting_template,
|
|
1016
|
+
@fail_on_putting_template_retry_exceed,
|
|
1017
|
+
@catch_transport_exception_on_retry) do
|
|
993
1018
|
if customize_template
|
|
994
1019
|
template_custom_install(template_name, @template_file, @template_overwrite, customize_template, @enable_ilm, deflector_alias, ilm_policy_id, host, target_index, @index_separator)
|
|
995
1020
|
else
|
|
@@ -58,6 +58,7 @@ class ElasticsearchFallbackSelectorTest < Test::Unit::TestCase
|
|
|
58
58
|
with_transporter_log true
|
|
59
59
|
reload_connections true
|
|
60
60
|
reload_after 10
|
|
61
|
+
catch_transport_exception_on_retry false # For fallback testing
|
|
61
62
|
]
|
|
62
63
|
assert_raise(Elasticsearch::Transport::Transport::Errors::NotFound) do
|
|
63
64
|
driver(config)
|
|
@@ -11,6 +11,9 @@ class TestElasticsearchIndexLifecycleManagement < Test::Unit::TestCase
|
|
|
11
11
|
rescue LoadError
|
|
12
12
|
omit "ILM testcase needs elasticsearch-xpack gem."
|
|
13
13
|
end
|
|
14
|
+
if Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.4.0")
|
|
15
|
+
omit "elastisearch-ruby v7.4.0 or later is needed for ILM."
|
|
16
|
+
end
|
|
14
17
|
Fluent::Plugin::ElasticsearchIndexLifecycleManagement.module_eval(<<-CODE)
|
|
15
18
|
def client
|
|
16
19
|
Elasticsearch::Client.new url: 'localhost:9200'
|
|
@@ -322,6 +322,19 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
322
322
|
assert_equal true, instance.client(nil, compressable).transport.options[:compression]
|
|
323
323
|
end
|
|
324
324
|
|
|
325
|
+
test 'check configure cloud_id based client' do
|
|
326
|
+
|
|
327
|
+
config = %{
|
|
328
|
+
cloud_id "name:bG9jYWxob3N0JGFiY2QkZWZnaA=="
|
|
329
|
+
cloud_auth "some:auth"
|
|
330
|
+
}
|
|
331
|
+
instance = driver(config).instance
|
|
332
|
+
|
|
333
|
+
assert_equal "name:bG9jYWxob3N0JGFiY2QkZWZnaA==", instance.cloud_id
|
|
334
|
+
assert_equal "some", instance.user
|
|
335
|
+
assert_equal "auth", instance.password
|
|
336
|
+
end
|
|
337
|
+
|
|
325
338
|
test 'configure Content-Type' do
|
|
326
339
|
config = %{
|
|
327
340
|
content_type application/x-ndjson
|
|
@@ -383,7 +396,13 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
383
396
|
data("legacy_template" => [true, "_template"],
|
|
384
397
|
"new_template" => [false, "_index_template"])
|
|
385
398
|
test 'valid configuration of index lifecycle management' do |data|
|
|
399
|
+
if Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.4.0")
|
|
400
|
+
omit "elastisearch-ruby v7.4.0 or later is needed for ILM."
|
|
401
|
+
end
|
|
386
402
|
use_legacy_template_flag, endpoint = data
|
|
403
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
404
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
405
|
+
end
|
|
387
406
|
cwd = File.dirname(__FILE__)
|
|
388
407
|
template_file = File.join(cwd, 'test_template.json')
|
|
389
408
|
|
|
@@ -419,7 +438,13 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
419
438
|
data("legacy_template" => [true, "_template"],
|
|
420
439
|
"new_template" => [false, "_index_template"])
|
|
421
440
|
test 'valid configuration of overwriting ilm_policy' do |data|
|
|
441
|
+
if Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.4.0")
|
|
442
|
+
omit "elastisearch-ruby v7.4.0 or later is needed for ILM."
|
|
443
|
+
end
|
|
422
444
|
use_legacy_template_flag, endpoint = data
|
|
445
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
446
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
447
|
+
end
|
|
423
448
|
cwd = File.dirname(__FILE__)
|
|
424
449
|
template_file = File.join(cwd, 'test_template.json')
|
|
425
450
|
|
|
@@ -823,6 +848,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
823
848
|
"new_template" => [false, "_index_template"])
|
|
824
849
|
def test_template_already_present(data)
|
|
825
850
|
use_legacy_template_flag, endpoint = data
|
|
851
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
852
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
853
|
+
end
|
|
826
854
|
config = %{
|
|
827
855
|
host logs.google.com
|
|
828
856
|
port 777
|
|
@@ -853,6 +881,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
853
881
|
"new_template" => [false, "_index_template"])
|
|
854
882
|
def test_template_create(data)
|
|
855
883
|
use_legacy_template_flag, endpoint = data
|
|
884
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
885
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
886
|
+
end
|
|
856
887
|
cwd = File.dirname(__FILE__)
|
|
857
888
|
template_file = if use_legacy_template_flag
|
|
858
889
|
File.join(cwd, 'test_template.json')
|
|
@@ -894,6 +925,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
894
925
|
"new_template" => [false, "_index_template"])
|
|
895
926
|
def test_template_create_with_rollover_index_and_template_related_placeholders(data)
|
|
896
927
|
use_legacy_template_flag, endpoint = data
|
|
928
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
929
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
930
|
+
end
|
|
897
931
|
cwd = File.dirname(__FILE__)
|
|
898
932
|
template_file = if use_legacy_template_flag
|
|
899
933
|
File.join(cwd, 'test_template.json')
|
|
@@ -959,6 +993,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
959
993
|
"new_template" => [false, "_index_template"])
|
|
960
994
|
def test_template_create_with_rollover_index_and_template_related_placeholders_with_truncating_caches(data)
|
|
961
995
|
use_legacy_template_flag, endpoint = data
|
|
996
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
997
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
998
|
+
end
|
|
962
999
|
cwd = File.dirname(__FILE__)
|
|
963
1000
|
template_file = if use_legacy_template_flag
|
|
964
1001
|
File.join(cwd, 'test_template.json')
|
|
@@ -1034,12 +1071,18 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
1034
1071
|
rescue LoadError
|
|
1035
1072
|
omit "ILM testcase needs elasticsearch-xpack gem."
|
|
1036
1073
|
end
|
|
1074
|
+
if Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.4.0")
|
|
1075
|
+
omit "elastisearch-ruby v7.4.0 or later is needed for ILM."
|
|
1076
|
+
end
|
|
1037
1077
|
end
|
|
1038
1078
|
|
|
1039
1079
|
data("legacy_template" => [true, "_template"],
|
|
1040
1080
|
"new_template" => [false, "_index_template"])
|
|
1041
1081
|
def test_template_create_with_rollover_index_and_default_ilm(data)
|
|
1042
1082
|
use_legacy_template_flag, endpoint = data
|
|
1083
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
1084
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
1085
|
+
end
|
|
1043
1086
|
cwd = File.dirname(__FILE__)
|
|
1044
1087
|
template_file = if use_legacy_template_flag
|
|
1045
1088
|
File.join(cwd, 'test_template.json')
|
|
@@ -1120,6 +1163,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
1120
1163
|
"new_template" => [false, "_index_template"])
|
|
1121
1164
|
def test_template_create_with_rollover_index_and_default_ilm_on_logstash_format(data)
|
|
1122
1165
|
use_legacy_template_flag, endpoint = data
|
|
1166
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
1167
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
1168
|
+
end
|
|
1123
1169
|
cwd = File.dirname(__FILE__)
|
|
1124
1170
|
template_file = if use_legacy_template_flag
|
|
1125
1171
|
File.join(cwd, 'test_template.json')
|
|
@@ -1209,6 +1255,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
1209
1255
|
"new_template" => [false, "_index_template"])
|
|
1210
1256
|
def test_template_create_with_rollover_index_and_default_ilm_and_ilm_policy_overwrite(data)
|
|
1211
1257
|
use_legacy_template_flag, endpoint = data
|
|
1258
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
1259
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
1260
|
+
end
|
|
1212
1261
|
cwd = File.dirname(__FILE__)
|
|
1213
1262
|
template_file = if use_legacy_template_flag
|
|
1214
1263
|
File.join(cwd, 'test_template.json')
|
|
@@ -1316,6 +1365,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
1316
1365
|
"new_template" => [false, "_index_template"])
|
|
1317
1366
|
def test_template_create_with_rollover_index_and_default_ilm_with_empty_index_date_pattern(data)
|
|
1318
1367
|
use_legacy_template_flag, endpoint = data
|
|
1368
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
1369
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
1370
|
+
end
|
|
1319
1371
|
cwd = File.dirname(__FILE__)
|
|
1320
1372
|
template_file = if use_legacy_template_flag
|
|
1321
1373
|
File.join(cwd, 'test_template.json')
|
|
@@ -1396,6 +1448,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
1396
1448
|
"new_template" => [false, "_index_template"])
|
|
1397
1449
|
def test_template_create_with_rollover_index_and_custom_ilm(data)
|
|
1398
1450
|
use_legacy_template_flag, endpoint = data
|
|
1451
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
1452
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
1453
|
+
end
|
|
1399
1454
|
cwd = File.dirname(__FILE__)
|
|
1400
1455
|
template_file = if use_legacy_template_flag
|
|
1401
1456
|
File.join(cwd, 'test_template.json')
|
|
@@ -1477,6 +1532,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
1477
1532
|
"new_template" => [false, "_index_template"])
|
|
1478
1533
|
def test_template_create_with_rollover_index_and_ilm_policies_and_placeholderstest_template_create_with_rollover_index_and_ilm_policies_and_placeholders(data)
|
|
1479
1534
|
use_legacy_template_flag, endpoint = data
|
|
1535
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
1536
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
1537
|
+
end
|
|
1480
1538
|
cwd = File.dirname(__FILE__)
|
|
1481
1539
|
template_file = if use_legacy_template_flag
|
|
1482
1540
|
File.join(cwd, 'test_template.json')
|
|
@@ -1565,6 +1623,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
1565
1623
|
"new_template" => [false, "_index_template"])
|
|
1566
1624
|
def test_tag_placeholder(data)
|
|
1567
1625
|
use_legacy_template_flag, endpoint = data
|
|
1626
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
1627
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
1628
|
+
end
|
|
1568
1629
|
cwd = File.dirname(__FILE__)
|
|
1569
1630
|
template_file = if use_legacy_template_flag
|
|
1570
1631
|
File.join(cwd, 'test_template.json')
|
|
@@ -1652,6 +1713,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
1652
1713
|
"new_template" => [false, "_index_template"])
|
|
1653
1714
|
def test_tag_placeholder_with_multiple_policies(data)
|
|
1654
1715
|
use_legacy_template_flag, endpoint = data
|
|
1716
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
1717
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
1718
|
+
end
|
|
1655
1719
|
cwd = File.dirname(__FILE__)
|
|
1656
1720
|
template_file = if use_legacy_template_flag
|
|
1657
1721
|
File.join(cwd, 'test_template.json')
|
|
@@ -1740,6 +1804,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
1740
1804
|
"new_template" => [false, "_index_template"])
|
|
1741
1805
|
def test_template_create_with_rollover_index_and_default_ilm_and_placeholders(data)
|
|
1742
1806
|
use_legacy_template_flag, endpoint = data
|
|
1807
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
1808
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
1809
|
+
end
|
|
1743
1810
|
cwd = File.dirname(__FILE__)
|
|
1744
1811
|
template_file = if use_legacy_template_flag
|
|
1745
1812
|
File.join(cwd, 'test_template.json')
|
|
@@ -1867,6 +1934,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
1867
1934
|
"new_template" => [false, "_index_template"])
|
|
1868
1935
|
def test_template_create_with_rollover_index_and_default_ilm_and_placeholders_and_index_separator(data)
|
|
1869
1936
|
use_legacy_template_flag, endpoint = data
|
|
1937
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
1938
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
1939
|
+
end
|
|
1870
1940
|
cwd = File.dirname(__FILE__)
|
|
1871
1941
|
template_file = if use_legacy_template_flag
|
|
1872
1942
|
File.join(cwd, 'test_template.json')
|
|
@@ -1956,6 +2026,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
1956
2026
|
"new_template" => [false, "_index_template"])
|
|
1957
2027
|
def test_template_create_with_rollover_index_and_default_ilm_and_custom_and_time_placeholders(data)
|
|
1958
2028
|
use_legacy_template_flag, endpoint = data
|
|
2029
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
2030
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
2031
|
+
end
|
|
1959
2032
|
cwd = File.dirname(__FILE__)
|
|
1960
2033
|
template_file = if use_legacy_template_flag
|
|
1961
2034
|
File.join(cwd, 'test_template.json')
|
|
@@ -2050,6 +2123,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
2050
2123
|
"new_template" => [false, "_index_template"])
|
|
2051
2124
|
def test_custom_template_create(data)
|
|
2052
2125
|
use_legacy_template_flag, endpoint = data
|
|
2126
|
+
|
|
2127
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
2128
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
2129
|
+
end
|
|
2053
2130
|
cwd = File.dirname(__FILE__)
|
|
2054
2131
|
template_file = if use_legacy_template_flag
|
|
2055
2132
|
File.join(cwd, 'test_alias_template.json')
|
|
@@ -2092,6 +2169,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
2092
2169
|
"new_template" => [false, "_index_template"])
|
|
2093
2170
|
def test_custom_template_create_with_customize_template_related_placeholders(data)
|
|
2094
2171
|
use_legacy_template_flag, endpoint = data
|
|
2172
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
2173
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
2174
|
+
end
|
|
2095
2175
|
cwd = File.dirname(__FILE__)
|
|
2096
2176
|
template_file = if use_legacy_template_flag
|
|
2097
2177
|
File.join(cwd, 'test_alias_template.json')
|
|
@@ -2142,6 +2222,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
2142
2222
|
"new_template" => [false, "_index_template"])
|
|
2143
2223
|
def test_custom_template_installation_for_host_placeholder(data)
|
|
2144
2224
|
use_legacy_template_flag, endpoint = data
|
|
2225
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
2226
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
2227
|
+
end
|
|
2145
2228
|
cwd = File.dirname(__FILE__)
|
|
2146
2229
|
template_file = if use_legacy_template_flag
|
|
2147
2230
|
File.join(cwd, 'test_template.json')
|
|
@@ -2188,6 +2271,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
2188
2271
|
"new_template" => [false, "_index_template"])
|
|
2189
2272
|
def test_custom_template_with_rollover_index_create(data)
|
|
2190
2273
|
use_legacy_template_flag, endpoint = data
|
|
2274
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
2275
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
2276
|
+
end
|
|
2191
2277
|
cwd = File.dirname(__FILE__)
|
|
2192
2278
|
template_file = if use_legacy_template_flag
|
|
2193
2279
|
File.join(cwd, 'test_alias_template.json')
|
|
@@ -2246,6 +2332,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
2246
2332
|
"new_template" => [false, "_index_template"])
|
|
2247
2333
|
def test_custom_template_with_rollover_index_create_and_deflector_alias(data)
|
|
2248
2334
|
use_legacy_template_flag, endpoint = data
|
|
2335
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
2336
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
2337
|
+
end
|
|
2249
2338
|
cwd = File.dirname(__FILE__)
|
|
2250
2339
|
template_file = if use_legacy_template_flag
|
|
2251
2340
|
File.join(cwd, 'test_alias_template.json')
|
|
@@ -2305,6 +2394,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
2305
2394
|
"new_template" => [false, "_index_template"])
|
|
2306
2395
|
def test_custom_template_with_rollover_index_create_with_logstash_format(data)
|
|
2307
2396
|
use_legacy_template_flag, endpoint = data
|
|
2397
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
2398
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
2399
|
+
end
|
|
2308
2400
|
cwd = File.dirname(__FILE__)
|
|
2309
2401
|
template_file = if use_legacy_template_flag
|
|
2310
2402
|
File.join(cwd, 'test_alias_template.json')
|
|
@@ -2373,12 +2465,18 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
2373
2465
|
rescue LoadError
|
|
2374
2466
|
omit "ILM testcase needs elasticsearch-xpack gem."
|
|
2375
2467
|
end
|
|
2468
|
+
if Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.4.0")
|
|
2469
|
+
omit "elastisearch-ruby v7.4.0 or later is needed."
|
|
2470
|
+
end
|
|
2376
2471
|
end
|
|
2377
2472
|
|
|
2378
2473
|
data("legacy_template" => [true, "_template"],
|
|
2379
2474
|
"new_template" => [false, "_index_template"])
|
|
2380
2475
|
def test_custom_template_with_rollover_index_create_and_default_ilm(data)
|
|
2381
2476
|
use_legacy_template_flag, endpoint = data
|
|
2477
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
2478
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
2479
|
+
end
|
|
2382
2480
|
cwd = File.dirname(__FILE__)
|
|
2383
2481
|
template_file = if use_legacy_template_flag
|
|
2384
2482
|
File.join(cwd, 'test_alias_template.json')
|
|
@@ -2463,6 +2561,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
2463
2561
|
"new_template" => [false, "_index_template"])
|
|
2464
2562
|
def test_custom_template_with_rollover_index_create_and_default_ilm_and_ilm_policy_overwrite(data)
|
|
2465
2563
|
use_legacy_template_flag, endpoint = data
|
|
2564
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
2565
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
2566
|
+
end
|
|
2466
2567
|
cwd = File.dirname(__FILE__)
|
|
2467
2568
|
template_file = if use_legacy_template_flag
|
|
2468
2569
|
File.join(cwd, 'test_alias_template.json')
|
|
@@ -2577,6 +2678,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
2577
2678
|
"new_template" => [false, "_index_template"])
|
|
2578
2679
|
def test_custom_template_with_rollover_index_create_and_default_ilm_and_placeholders(data)
|
|
2579
2680
|
use_legacy_template_flag, endpoint = data
|
|
2681
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
2682
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
2683
|
+
end
|
|
2580
2684
|
cwd = File.dirname(__FILE__)
|
|
2581
2685
|
template_file = if use_legacy_template_flag
|
|
2582
2686
|
File.join(cwd, 'test_alias_template.json')
|
|
@@ -2720,6 +2824,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
2720
2824
|
"new_template" => [false, "_index_template"])
|
|
2721
2825
|
def test_custom_template_with_rollover_index_create_and_custom_ilm(data)
|
|
2722
2826
|
use_legacy_template_flag, endpoint = data
|
|
2827
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
2828
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
2829
|
+
end
|
|
2723
2830
|
cwd = File.dirname(__FILE__)
|
|
2724
2831
|
template_file = if use_legacy_template_flag
|
|
2725
2832
|
File.join(cwd, 'test_alias_template.json')
|
|
@@ -2798,6 +2905,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
2798
2905
|
"new_template" => [false, "_index_template"])
|
|
2799
2906
|
def test_template_overwrite(data)
|
|
2800
2907
|
use_legacy_template_flag, endpoint = data
|
|
2908
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
2909
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
2910
|
+
end
|
|
2801
2911
|
cwd = File.dirname(__FILE__)
|
|
2802
2912
|
template_file = if use_legacy_template_flag
|
|
2803
2913
|
File.join(cwd, 'test_template.json')
|
|
@@ -2840,6 +2950,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
2840
2950
|
"new_template" => [false, "_index_template"])
|
|
2841
2951
|
def test_custom_template_overwrite(data)
|
|
2842
2952
|
use_legacy_template_flag, endpoint = data
|
|
2953
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
2954
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
2955
|
+
end
|
|
2843
2956
|
cwd = File.dirname(__FILE__)
|
|
2844
2957
|
template_file = if use_legacy_template_flag
|
|
2845
2958
|
File.join(cwd, 'test_template.json')
|
|
@@ -2883,6 +2996,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
2883
2996
|
"new_template" => [false, "_index_template"])
|
|
2884
2997
|
def test_custom_template_with_rollover_index_overwrite(data)
|
|
2885
2998
|
use_legacy_template_flag, endpoint = data
|
|
2999
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
3000
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
3001
|
+
end
|
|
2886
3002
|
cwd = File.dirname(__FILE__)
|
|
2887
3003
|
template_file = if use_legacy_template_flag
|
|
2888
3004
|
File.join(cwd, 'test_template.json')
|
|
@@ -2969,6 +3085,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
2969
3085
|
"new_template" => [false, "_index_template"])
|
|
2970
3086
|
def test_template_create_for_host_placeholder(data)
|
|
2971
3087
|
use_legacy_template_flag, endpoint = data
|
|
3088
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
3089
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
3090
|
+
end
|
|
2972
3091
|
cwd = File.dirname(__FILE__)
|
|
2973
3092
|
template_file = if use_legacy_template_flag
|
|
2974
3093
|
File.join(cwd, 'test_template.json')
|
|
@@ -3017,6 +3136,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
3017
3136
|
"new_template" => [false, "_index_template"])
|
|
3018
3137
|
def test_template_retry_install_fails(data)
|
|
3019
3138
|
use_legacy_template_flag, endpoint = data
|
|
3139
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
3140
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
3141
|
+
end
|
|
3020
3142
|
cwd = File.dirname(__FILE__)
|
|
3021
3143
|
template_file = if use_legacy_template_flag
|
|
3022
3144
|
File.join(cwd, 'test_template.json')
|
|
@@ -3052,10 +3174,54 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
3052
3174
|
assert_equal(4, connection_resets)
|
|
3053
3175
|
end
|
|
3054
3176
|
|
|
3177
|
+
transport_errors_handled_separately = [Elasticsearch::Transport::Transport::Errors::NotFound]
|
|
3178
|
+
transport_errors = Elasticsearch::Transport::Transport::Errors.constants.map { |err| [err, Elasticsearch::Transport::Transport::Errors.const_get(err)] }
|
|
3179
|
+
transport_errors_hash = Hash[transport_errors.select { |err| !transport_errors_handled_separately.include?(err[1]) } ]
|
|
3180
|
+
|
|
3181
|
+
data(transport_errors_hash)
|
|
3182
|
+
def test_template_retry_transport_errors(error)
|
|
3183
|
+
endpoint, use_legacy_template_flag = if Gem::Version.create(::Elasticsearch::Transport::VERSION) >= Gem::Version.create("7.8.0")
|
|
3184
|
+
["_index_template".freeze, false]
|
|
3185
|
+
else
|
|
3186
|
+
["_template".freeze, true]
|
|
3187
|
+
end
|
|
3188
|
+
cwd = File.dirname(__FILE__)
|
|
3189
|
+
template_file = File.join(cwd, 'test_index_template.json')
|
|
3190
|
+
|
|
3191
|
+
config = %{
|
|
3192
|
+
host logs.google.com
|
|
3193
|
+
port 778
|
|
3194
|
+
scheme https
|
|
3195
|
+
path /es/
|
|
3196
|
+
user john
|
|
3197
|
+
password doe
|
|
3198
|
+
template_name logstash
|
|
3199
|
+
template_file #{template_file}
|
|
3200
|
+
max_retry_putting_template 0
|
|
3201
|
+
use_legacy_template #{use_legacy_template_flag}
|
|
3202
|
+
}
|
|
3203
|
+
|
|
3204
|
+
retries = 0
|
|
3205
|
+
stub_request(:get, "https://logs.google.com:778/es//#{endpoint}/logstash")
|
|
3206
|
+
.with(basic_auth: ['john', 'doe']) do |req|
|
|
3207
|
+
retries += 1
|
|
3208
|
+
raise error
|
|
3209
|
+
end
|
|
3210
|
+
|
|
3211
|
+
assert_raise(Fluent::Plugin::ElasticsearchError::RetryableOperationExhaustedFailure) do
|
|
3212
|
+
driver(config)
|
|
3213
|
+
end
|
|
3214
|
+
|
|
3215
|
+
assert_equal(1, retries)
|
|
3216
|
+
end
|
|
3217
|
+
|
|
3055
3218
|
data("legacy_template" => [true, "_template"],
|
|
3056
3219
|
"new_template" => [false, "_index_template"])
|
|
3057
3220
|
def test_template_retry_install_does_not_fail(data)
|
|
3058
3221
|
use_legacy_template_flag, endpoint = data
|
|
3222
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
3223
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
3224
|
+
end
|
|
3059
3225
|
cwd = File.dirname(__FILE__)
|
|
3060
3226
|
template_file = if use_legacy_template_flag
|
|
3061
3227
|
File.join(cwd, 'test_template.json')
|
|
@@ -3094,6 +3260,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
3094
3260
|
"new_template" => [false, "_index_template"])
|
|
3095
3261
|
def test_templates_create(data)
|
|
3096
3262
|
use_legacy_template_flag, endpoint = data
|
|
3263
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
3264
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
3265
|
+
end
|
|
3097
3266
|
cwd = File.dirname(__FILE__)
|
|
3098
3267
|
template_file = if use_legacy_template_flag
|
|
3099
3268
|
File.join(cwd, 'test_template.json')
|
|
@@ -3148,6 +3317,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
3148
3317
|
"new_template" => [false, "_index_template"])
|
|
3149
3318
|
def test_templates_overwrite(data)
|
|
3150
3319
|
use_legacy_template_flag, endpoint = data
|
|
3320
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
3321
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
3322
|
+
end
|
|
3151
3323
|
cwd = File.dirname(__FILE__)
|
|
3152
3324
|
template_file = if use_legacy_template_flag
|
|
3153
3325
|
File.join(cwd, 'test_template.json')
|
|
@@ -3202,6 +3374,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
3202
3374
|
"new_template" => [false, "_index_template"])
|
|
3203
3375
|
def test_templates_are_also_used(data)
|
|
3204
3376
|
use_legacy_template_flag, endpoint = data
|
|
3377
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
3378
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
3379
|
+
end
|
|
3205
3380
|
cwd = File.dirname(__FILE__)
|
|
3206
3381
|
template_file = if use_legacy_template_flag
|
|
3207
3382
|
File.join(cwd, 'test_template.json')
|
|
@@ -3258,6 +3433,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
|
3258
3433
|
"new_template" => [false, "_index_template"])
|
|
3259
3434
|
def test_templates_can_be_partially_created_if_error_occurs(data)
|
|
3260
3435
|
use_legacy_template_flag, endpoint = data
|
|
3436
|
+
if !use_legacy_template_flag && Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.8.0")
|
|
3437
|
+
omit "elastisearch-ruby v7.8.0 or later is needed."
|
|
3438
|
+
end
|
|
3261
3439
|
cwd = File.dirname(__FILE__)
|
|
3262
3440
|
template_file = if use_legacy_template_flag
|
|
3263
3441
|
File.join(cwd, 'test_template.json')
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluent-plugin-elasticsearch
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- diogo
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2020-
|
|
13
|
+
date: 2020-12-04 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: fluentd
|
|
@@ -135,6 +135,8 @@ extra_rdoc_files: []
|
|
|
135
135
|
files:
|
|
136
136
|
- ".coveralls.yml"
|
|
137
137
|
- ".editorconfig"
|
|
138
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
|
139
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
|
138
140
|
- ".github/workflows/issue-auto-closer.yml"
|
|
139
141
|
- ".github/workflows/linux.yml"
|
|
140
142
|
- ".github/workflows/macos.yml"
|