fluent-plugin-elasticsearch 4.3.2 → 4.3.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: 69be22981ce5e59de9e573f933c29b51cbf8204ba849fb6ad3729482f94361c0
4
- data.tar.gz: f20f079c0dfce9a2c763f89572f4b64e22b790e7b90a5eb542b5c129f6160bad
3
+ metadata.gz: ed7efe8849b8a7ca1d2cc3c81444e604c0bda824209f9297f0114f01c1ba609a
4
+ data.tar.gz: f74f8726fa993c3e4bc01b742e97ef4579fb7335809aac2dabce03c2b002e9ad
5
5
  SHA512:
6
- metadata.gz: 966e0aee9947dcfebe785713118dc014df4216ed34565e5a1672547a47eabef2cb93f15442165ca2249d633b272d41602a52d172675a1d8df50c83516c602ff8
7
- data.tar.gz: 714f4b5048b78fad7d30fea2a5a0bce2d824fa2c6585ec480c3dd8bece71c9378a0faa0514906094a3a217662e12bc3d4e86ce9853b6e6977b077954b76fa489
6
+ metadata.gz: 6adeee82a86f8217f9e6d259990042330d8a96a3a3ddb03a332a90f4ce90996c99aff7385b05c625eee4c6253b9647ba2bfc7856f51ba306ef7df6917d716fb4
7
+ data.tar.gz: dec1a1a72c88c2fd4df38e1b57ca883d47c5f28582fb5ba9a9210c882986c5e52a44f4eda03bef708961b461555b1538968b905b346e6782ad1090ca4310747d
data/History.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  ### [Unreleased]
4
4
 
5
+ ### 4.3.3
6
+ - Handle invalid Elasticsearch::Client#info response (#855)
7
+
5
8
  ### 4.3.2
6
9
  - Use log.debug to dump ES 8.x _type information (#852)
7
10
 
@@ -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.3.2'
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}
@@ -493,7 +493,12 @@ EOC
493
493
 
494
494
  def detect_es_major_version
495
495
  @_es_info ||= client.info
496
- unless version = @_es_info.dig("version", "number")
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
497
502
  version = @default_elasticsearch_version
498
503
  end
499
504
  version.to_i
@@ -370,6 +370,65 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
370
370
  }
371
371
  end
372
372
 
373
+ sub_test_case 'Check client.info response' do
374
+ def create_driver(conf='', es_version=5, client_version="\"5.0\"")
375
+ # For request stub to detect compatibility.
376
+ @client_version ||= client_version
377
+ @default_elasticsearch_version ||= es_version
378
+ Fluent::Plugin::ElasticsearchOutput.module_eval(<<-CODE)
379
+ def detect_es_major_version
380
+ @_es_info ||= client.info
381
+ begin
382
+ unless version = @_es_info.dig("version", "number")
383
+ version = @default_elasticsearch_version
384
+ end
385
+ rescue NoMethodError => e
386
+ log.warn "#{@_es_info} can not dig version information. Assuming Elasticsearch #{@default_elasticsearch_version}", error: e
387
+ version = @default_elasticsearch_version
388
+ end
389
+ version.to_i
390
+ end
391
+ CODE
392
+
393
+ Fluent::Plugin::ElasticsearchOutput.module_eval(<<-CODE)
394
+ def client_library_version
395
+ #{@client_version}
396
+ end
397
+ CODE
398
+ @driver ||= Fluent::Test::Driver::Output.new(Fluent::Plugin::ElasticsearchOutput) {
399
+ # v0.12's test driver assume format definition. This simulates ObjectBufferedOutput format
400
+ if !defined?(Fluent::Plugin::Output)
401
+ def format(tag, time, record)
402
+ [time, record].to_msgpack
403
+ end
404
+ end
405
+ }.configure(conf)
406
+ end
407
+
408
+ def stub_elastic_info_bad(url="http://localhost:9200/", version="6.4.2")
409
+ body ="{\"version\":{\"number\":\"#{version}\"}}"
410
+ stub_request(:get, url).to_return({:status => 200, :body => body, :headers => { 'Content-Type' => 'text/plain' } })
411
+ end
412
+
413
+ test 'handle invalid client.info' do
414
+ stub_elastic_info_bad("https://logs.fluentd.com:24225/es//", "7.7.1")
415
+ config = %{
416
+ host logs.fluentd.com
417
+ port 24225
418
+ scheme https
419
+ path /es/
420
+ user john
421
+ password doe
422
+ default_elasticsearch_version 7
423
+ scheme https
424
+ @log_level info
425
+ }
426
+ d = create_driver(config, 7, "\"7.10.1\"")
427
+ logs = d.logs
428
+ assert_logs_include(logs, /can not dig version information. Assuming Elasticsearch 7/)
429
+ end
430
+ end
431
+
373
432
  sub_test_case 'Check TLS handshake stuck warning log' do
374
433
  test 'warning TLS log' do
375
434
  config = %{
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.3.2
4
+ version: 4.3.3
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-12-07 00:00:00.000000000 Z
13
+ date: 2020-12-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fluentd