fluent-plugin-elasticsearch 5.1.1 → 5.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27d74e7048671def02b98e337c052c395152021a4a3f4c2138d1780c725d09bd
4
- data.tar.gz: eb5282b8e688b091700a549c711af2f1959bc9b1b2c4f6fd1b49e3119c62ddb7
3
+ metadata.gz: df6dbece6029cfcd3e8d23d31b9a0e2152f1888a65575dfef5bb31a52975a91b
4
+ data.tar.gz: 1ac87a0f1671e02e1805e127a0de03eef3df2565d015189394cb3257c9965097
5
5
  SHA512:
6
- metadata.gz: 3a3ad9fa5259fcd1e80a85bdf7d1acd11cd26675d4f47f326100db242f0f9320232530099eb5346e5ea11aba76c4cc66cfc2e97f6393ca95d1227281217283ea
7
- data.tar.gz: f97182a9487be71d34ddcd8ec2dd046eca9c6de1cae55d3842feeeaef627f23a05862be4783aee37fe38c84cba3bf984a51fb7fb3e8bad50f1bf0f57c956803e
6
+ metadata.gz: f58752ca5855d83399dcd7e5e79df6d7196f21321f6749afc688ef651c9d39e4c2e46f145151b27885ba6087237e286b2a8d7ed9ebd724fdba6bbb1a9f776da0
7
+ data.tar.gz: 207b47dd4efde2d1460f23e3d6f9aebfa9d095cb664180a93f24795b6984e5d647126c2f52d6865e55980f3d5a52269bc45fceb3791100cfbebe67f93040eb6e
data/History.md CHANGED
@@ -2,8 +2,11 @@
2
2
 
3
3
  ### [Unreleased]
4
4
 
5
+ ### 5.1.2
6
+ - Fix default values of datastream parameters (#926)
7
+
5
8
  ### 5.1.1
6
- - Report appropriate error for data_stream parameters (#922)
9
+ - Report appropriate error for data_stream parameters (#922)
7
10
  - Add ILM and template parameters for data streams (#920)
8
11
  - Support Buffer in Data Stream Output (#917)
9
12
 
@@ -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 = '5.1.1'
6
+ s.version = '5.1.2'
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}
@@ -9,8 +9,8 @@ module Fluent::Plugin
9
9
  helpers :event_emitter
10
10
 
11
11
  config_param :data_stream_name, :string
12
- config_param :data_stream_ilm_name, :string, :default => :data_stream_name
13
- config_param :data_stream_template_name, :string, :default => :data_stream_name
12
+ config_param :data_stream_ilm_name, :string, :default => nil
13
+ config_param :data_stream_template_name, :string, :default => nil
14
14
  # Elasticsearch 7.9 or later always support new style of index template.
15
15
  config_set_default :use_legacy_template, false
16
16
 
@@ -27,6 +27,9 @@ module Fluent::Plugin
27
27
  raise Fluent::ConfigError, "'elasticsearch/api', 'elasticsearch/xpack' are required for <@elasticsearch_data_stream>."
28
28
  end
29
29
 
30
+ @data_stream_ilm_name = "#{@data_stream_name}_policy" if @data_stream_ilm_name.nil?
31
+ @data_stream_template_name = "#{@data_stream_name}_template" if @data_stream_template_name.nil?
32
+
30
33
  # ref. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-data-stream.html
31
34
  unless placeholder?(:data_stream_name_placeholder, @data_stream_name)
32
35
  validate_data_stream_parameters
@@ -93,7 +96,7 @@ module Fluent::Plugin
93
96
  "data_stream" => {},
94
97
  "template" => {
95
98
  "settings" => {
96
- "index.lifecycle.name" => "#{ilm_name}_policy"
99
+ "index.lifecycle.name" => "#{ilm_name}"
97
100
  }
98
101
  }
99
102
  }
@@ -455,6 +455,61 @@ class ElasticsearchOutputDataStreamTest < Test::Unit::TestCase
455
455
  assert_equal "foo", driver(conf).instance.data_stream_name
456
456
  end
457
457
 
458
+ def test_template_unset
459
+ omit REQUIRED_ELASTIC_MESSAGE unless data_stream_supported?
460
+
461
+ stub_ilm_policy
462
+ stub_index_template
463
+ stub_existent_data_stream?
464
+ stub_data_stream
465
+ stub_elastic_info
466
+ conf = config_element(
467
+ 'ROOT', '', {
468
+ '@type' => ELASTIC_DATA_STREAM_TYPE,
469
+ 'data_stream_name' => 'foo',
470
+ 'data_stream_ilm_name' => "foo_ilm",
471
+ })
472
+ assert_equal "foo", driver(conf).instance.data_stream_name
473
+ assert_equal "foo_ilm", driver(conf).instance.data_stream_ilm_name
474
+ assert_equal "foo_template", driver(conf).instance.data_stream_template_name
475
+ end
476
+
477
+ def test_ilm_unset
478
+ omit REQUIRED_ELASTIC_MESSAGE unless data_stream_supported?
479
+
480
+ stub_ilm_policy
481
+ stub_index_template
482
+ stub_existent_data_stream?
483
+ stub_data_stream
484
+ stub_elastic_info
485
+ conf = config_element(
486
+ 'ROOT', '', {
487
+ '@type' => ELASTIC_DATA_STREAM_TYPE,
488
+ 'data_stream_name' => 'foo',
489
+ 'data_stream_template_name' => "foo_tpl"
490
+ })
491
+ assert_equal "foo", driver(conf).instance.data_stream_name
492
+ assert_equal "foo_tpl", driver(conf).instance.data_stream_template_name
493
+ end
494
+
495
+ def test_template_and_ilm_unset
496
+ omit REQUIRED_ELASTIC_MESSAGE unless data_stream_supported?
497
+
498
+ stub_ilm_policy
499
+ stub_index_template
500
+ stub_existent_data_stream?
501
+ stub_data_stream
502
+ stub_elastic_info
503
+ conf = config_element(
504
+ 'ROOT', '', {
505
+ '@type' => ELASTIC_DATA_STREAM_TYPE,
506
+ 'data_stream_name' => 'foo',
507
+ })
508
+ assert_equal "foo", driver(conf).instance.data_stream_name
509
+ assert_equal "foo_template", driver(conf).instance.data_stream_template_name
510
+ assert_equal "foo_policy", driver(conf).instance.data_stream_ilm_name
511
+ end
512
+
458
513
  def test_placeholder
459
514
  omit REQUIRED_ELASTIC_MESSAGE unless data_stream_supported?
460
515
 
@@ -476,6 +531,26 @@ class ElasticsearchOutputDataStreamTest < Test::Unit::TestCase
476
531
  assert_equal 1, @bulk_records
477
532
  end
478
533
 
534
+ def test_placeholder_params_unset
535
+ omit REQUIRED_ELASTIC_MESSAGE unless data_stream_supported?
536
+
537
+ dsname = "foo_test"
538
+ ilmname = "foo_test_policy"
539
+ tplname = "foo_test_template"
540
+ stub_default(dsname, ilmname, tplname)
541
+ stub_bulk_feed(dsname, ilmname, tplname)
542
+ conf = config_element(
543
+ 'ROOT', '', {
544
+ '@type' => ELASTIC_DATA_STREAM_TYPE,
545
+ 'data_stream_name' => 'foo_${tag}',
546
+ })
547
+ driver(conf).run(default_tag: 'test') do
548
+ driver.feed(sample_record)
549
+ end
550
+ assert_equal 1, @bulk_records
551
+ end
552
+
553
+
479
554
  def test_time_placeholder
480
555
  omit REQUIRED_ELASTIC_MESSAGE unless data_stream_supported?
481
556
 
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: 5.1.1
4
+ version: 5.1.2
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: 2021-10-20 00:00:00.000000000 Z
13
+ date: 2021-11-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fluentd
@@ -156,7 +156,6 @@ files:
156
156
  - ".github/workflows/macos.yml"
157
157
  - ".github/workflows/windows.yml"
158
158
  - ".gitignore"
159
- - ".travis.yml"
160
159
  - CONTRIBUTING.md
161
160
  - Gemfile
162
161
  - History.md
@@ -168,7 +167,6 @@ files:
168
167
  - README.Troubleshooting.md
169
168
  - README.md
170
169
  - Rakefile
171
- - appveyor.yml
172
170
  - fluent-plugin-elasticsearch.gemspec
173
171
  - gemfiles/Gemfile.elasticsearch.v6
174
172
  - lib/fluent/log-ext.rb
data/.travis.yml DELETED
@@ -1,40 +0,0 @@
1
- language: ruby
2
-
3
- jobs:
4
- include:
5
- - rvm: 2.4.6
6
- gemfile: Gemfile
7
- os: linux
8
- arch: amd64
9
- - rvm: 2.5.5
10
- gemfile: Gemfile
11
- os: linux
12
- arch: amd64
13
- - rvm: 2.6.3
14
- gemfile: gemfiles/Gemfile.elasticsearch.v6
15
- os: linux
16
- arch: amd64
17
- - rvm: 2.6.3
18
- gemfile: Gemfile
19
- os: linux
20
- arch: amd64
21
- - rvm: 2.6.3
22
- gemfile: Gemfile
23
- os: linux
24
- arch: arm64
25
- - rvm: 2.6.3
26
- gemfile: Gemfile
27
- os: osx
28
- osx_image: xcode11.3
29
- - rvm: 2.7.0
30
- gemfile: Gemfile
31
- os: linux
32
- arch: amd64
33
-
34
- gemfile:
35
- - Gemfile
36
-
37
- before_install:
38
- - gem update --system=2.7.8
39
-
40
- script: bundle exec rake test
data/appveyor.yml DELETED
@@ -1,20 +0,0 @@
1
- version: '{build}'
2
- install:
3
- - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
4
- - ridk.cmd enable
5
- - ruby --version
6
- - gem --version
7
- - bundle install
8
- build: off
9
- test_script:
10
- - bundle exec rake test
11
-
12
- # https://www.appveyor.com/docs/installed-software/#ruby
13
- environment:
14
- matrix:
15
- - ruby_version: "26-x64"
16
- - ruby_version: "26"
17
- - ruby_version: "25-x64"
18
- - ruby_version: "25"
19
- - ruby_version: "24-x64"
20
- - ruby_version: "24"