fluent-plugin-elasticsearch 4.3.2 → 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/History.md +3 -0
- data/fluent-plugin-elasticsearch.gemspec +1 -1
- data/lib/fluent/plugin/out_elasticsearch.rb +6 -1
- data/test/plugin/test_out_elasticsearch.rb +59 -0
- metadata +2 -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
|
data/History.md
CHANGED
@@ -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.
|
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
|
-
|
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.
|
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-
|
13
|
+
date: 2020-12-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: fluentd
|