fluent-plugin-elasticsearch 3.4.2 → 3.4.3

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: 3882c4cbe493e8dcbba56ddd5af9bd1ecdc85bea95e19bbe4f4fd302b5cc5edf
4
- data.tar.gz: a184602aae1d5665879cb2cbc01910068af76f4579af630a7b466a9d495c62ed
3
+ metadata.gz: 599f144cfd094f25416002686c3f4c11b693c3f5a28c33d18ddd670639d95b6f
4
+ data.tar.gz: fcfcfaf1c73a5338740934d887273399a7b4396a2246f392ceb779281a7da9d7
5
5
  SHA512:
6
- metadata.gz: a6e9fb90f39b99907ec3df6dc1770d9eaa449cbee292669d1de7b13d2a38488683c4820a755553410c81fbd6e665ea573750d790b8bf7ad91304213baddc6b49
7
- data.tar.gz: f047c3a93f5bc9c3609b6c6c2505730a11c7b5d7f4410fe0e7f950a3dc5e995336f541023997a7a3dd28149872f3af457c796cf37c438e0c93f72bcb8eed11d6
6
+ metadata.gz: 0c7a7176b04bbb770ad1ad9fd7f67a1f4ff8cdc7b4206fca5e1e677518c00ffa2329a1ae5ebeb1dd25e2d5324edd8df5e4c92a90c59a337b7ed2e68827aef4b6
7
+ data.tar.gz: 69f91ef1ecbd148da6feac924f1d8c86668aa50191a76eccd53d9968e5ae47f6b33039ea1c693784fe89c688f0e4ee772077e9085ac511032b1490bdf3565706
data/History.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  ### [Unreleased]
4
4
 
5
+ ### 3.4.3
6
+ - Add fail_on_putting_template_retry_exceed config (#579)
7
+
5
8
  ### 3.4.2
6
9
  - Comparing DEFAULT_TYPE_NAME_ES_7x to target_type instead of type_name (#573)
7
10
 
data/README.md CHANGED
@@ -43,6 +43,7 @@ Current maintainers: @cosmo0920
43
43
  + [index_prefix](#index_prefix)
44
44
  + [templates](#templates)
45
45
  + [max_retry_putting_template](#max_retry_putting_template)
46
+ + [fail_on_putting_template_retry_exceed](#fail_on_putting_template_retry_exceed)
46
47
  + [max_retry_get_es_version](#max_retry_get_es_version)
47
48
  + [request_timeout](#request_timeout)
48
49
  + [reload_connections](#reload_connections)
@@ -450,6 +451,15 @@ Usually, booting up clustered Elasticsearch containers are much slower than laun
450
451
  max_retry_putting_template 15 # defaults to 10
451
452
  ```
452
453
 
454
+ ### fail_on_putting_template_retry_exceed
455
+
456
+ Indicates whether to fail when `max_retry_putting_template` is exceeded.
457
+ If you have multiple output plugin, you could use this property to do not fail on fluentd statup.
458
+
459
+ ```
460
+ fail_on_putting_template_retry_exceed false # defaults to true
461
+ ```
462
+
453
463
  ### max_retry_get_es_version
454
464
 
455
465
  You can specify times of retry obtaining Elasticsearch version.
@@ -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 = '3.4.2'
6
+ s.version = '3.4.3'
7
7
  s.authors = ['diogo', 'pitr']
8
8
  s.email = ['pitr.vern@gmail.com', 'me@diogoterror.com']
9
9
  s.description = %q{Elasticsearch output plugin for Fluent event collector}
@@ -28,7 +28,7 @@ module Fluent::ElasticsearchIndexTemplate
28
28
  return false
29
29
  end
30
30
 
31
- def retry_operate(max_retries)
31
+ def retry_operate(max_retries, fail_on_retry_exceed = true)
32
32
  return unless block_given?
33
33
  retries = 0
34
34
  begin
@@ -42,8 +42,10 @@ module Fluent::ElasticsearchIndexTemplate
42
42
  log.warn "Could not communicate to Elasticsearch, resetting connection and trying again. #{e.message}"
43
43
  retry
44
44
  end
45
+ message = "Could not communicate to Elasticsearch after #{retries} retries. #{e.message}"
46
+ log.warn message
45
47
  raise Fluent::Plugin::ElasticsearchError::RetryableOperationExhaustedFailure,
46
- "Could not communicate to Elasticsearch after #{retries} retries. #{e.message}"
48
+ message if fail_on_retry_exceed
47
49
  end
48
50
  end
49
51
 
@@ -109,6 +109,7 @@ EOC
109
109
  config_param :application_name, :string, :default => "default"
110
110
  config_param :templates, :hash, :default => nil
111
111
  config_param :max_retry_putting_template, :integer, :default => 10
112
+ config_param :fail_on_putting_template_retry_exceed, :bool, :default => true
112
113
  config_param :max_retry_get_es_version, :integer, :default => 15
113
114
  config_param :include_tag_key, :bool, :default => false
114
115
  config_param :tag_key, :string, :default => 'tag'
@@ -185,7 +186,7 @@ EOC
185
186
 
186
187
  if !Fluent::Engine.dry_run_mode
187
188
  if @template_name && @template_file
188
- retry_operate(@max_retry_putting_template) do
189
+ retry_operate(@max_retry_putting_template, @fail_on_putting_template_retry_exceed) do
189
190
  if @customize_template
190
191
  if @rollover_index
191
192
  raise Fluent::ConfigError, "'deflector_alias' must be provided if 'rollover_index' is set true ." if not @deflector_alias
@@ -196,7 +197,7 @@ EOC
196
197
  end
197
198
  end
198
199
  elsif @templates
199
- retry_operate(@max_retry_putting_template) do
200
+ retry_operate(@max_retry_putting_template, @fail_on_putting_template_retry_exceed) do
200
201
  templates_hash_install(@templates, @template_overwrite)
201
202
  end
202
203
  end
@@ -679,7 +679,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
679
679
  end
680
680
  end
681
681
 
682
- def test_template_retry_install
682
+ def test_template_retry_install_fails
683
683
  cwd = File.dirname(__FILE__)
684
684
  template_file = File.join(cwd, 'test_template.json')
685
685
 
@@ -709,6 +709,35 @@ class ElasticsearchOutput < Test::Unit::TestCase
709
709
  assert_equal(connection_resets, 4)
710
710
  end
711
711
 
712
+ def test_template_retry_install_does_not_fail
713
+ cwd = File.dirname(__FILE__)
714
+ template_file = File.join(cwd, 'test_template.json')
715
+
716
+ config = %{
717
+ host logs.google.com
718
+ port 778
719
+ scheme https
720
+ path /es/
721
+ user john
722
+ password doe
723
+ template_name logstash
724
+ template_file #{template_file}
725
+ max_retry_putting_template 3
726
+ fail_on_putting_template_retry_exceed false
727
+ }
728
+
729
+ connection_resets = 0
730
+ # check if template exists
731
+ stub_request(:get, "https://john:doe@logs.google.com:778/es//_template/logstash").with do |req|
732
+ connection_resets += 1
733
+ raise Faraday::ConnectionFailed, "Test message"
734
+ end
735
+
736
+ driver(config)
737
+
738
+ assert_equal(connection_resets, 4)
739
+ end
740
+
712
741
  def test_templates_create
713
742
  cwd = File.dirname(__FILE__)
714
743
  template_file = 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: 3.4.2
4
+ version: 3.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - diogo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-04-14 00:00:00.000000000 Z
12
+ date: 2019-04-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
181
  requirements: []
182
- rubygems_version: 3.0.3
182
+ rubygems_version: 3.0.1
183
183
  signing_key:
184
184
  specification_version: 4
185
185
  summary: Elasticsearch output plugin for Fluent event collector