fluent-plugin-elasticsearch 5.0.4 → 5.0.5
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/workflows/linux.yml +1 -1
- data/.github/workflows/macos.yml +1 -1
- data/.github/workflows/windows.yml +1 -1
- data/History.md +4 -0
- data/fluent-plugin-elasticsearch.gemspec +1 -1
- data/lib/fluent/plugin/elasticsearch_error_handler.rb +11 -1
- data/test/plugin/test_elasticsearch_error_handler.rb +19 -7
- 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: 0e7a5cd238a268dd3f141ce4ad1dedfacbacc98fdd22f73839bb0e1cdbccc586
|
4
|
+
data.tar.gz: 8077a55fae311fd0bd9cd84fc2b2eb34fad8f7a2a890b2707d37c7ac1c753975
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bede6c6213db75e2636c6bf31e65b3256ae709ef600b9f3fca8973943344e07421daf4ed04fc0f3dd06f6b1f662c93c27d9240a323f8139aee3bf2a99ed0f9b
|
7
|
+
data.tar.gz: caed0a434434c903451cdd4b92ae4427ca39984a8405154308d70a2b68351c6a05b7e505c08cd776230cef9dbbda46f4256cd7de138f3549a1860b5b6cee8e3c
|
data/.github/workflows/linux.yml
CHANGED
data/.github/workflows/macos.yml
CHANGED
data/History.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
### [Unreleased]
|
4
4
|
|
5
|
+
### 5.0.5
|
6
|
+
- Drop json_parse_exception messages for bulk failures (#900)
|
7
|
+
- GitHub Actions: Drop Ruby 2.5 due to EOL (#894)
|
8
|
+
|
5
9
|
### 5.0.4
|
6
10
|
- test: out_elasticsearch: Remove a needless headers from affinity stub (#888)
|
7
11
|
- Target Index Affinity (#883)
|
@@ -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.0.
|
6
|
+
s.version = '5.0.5'
|
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}
|
@@ -23,6 +23,10 @@ class Fluent::Plugin::ElasticsearchErrorHandler
|
|
23
23
|
unrecoverable_error_types.include?(type)
|
24
24
|
end
|
25
25
|
|
26
|
+
def unrecoverable_record_error?(type)
|
27
|
+
['json_parse_exception'].include?(type)
|
28
|
+
end
|
29
|
+
|
26
30
|
def log_es_400_reason(&block)
|
27
31
|
if @plugin.log_es_400_reason
|
28
32
|
block.call
|
@@ -53,6 +57,7 @@ class Fluent::Plugin::ElasticsearchErrorHandler
|
|
53
57
|
meta, header, record = @plugin.process_message(tag, meta, header, time, processrecord, affinity_target_indices, extracted_values)
|
54
58
|
next unless @plugin.append_record_to_messages(@plugin.write_operation, meta, header, record, bulk_message)
|
55
59
|
rescue => e
|
60
|
+
@plugin.log.debug("Exception in error handler during deep copy: #{e}")
|
56
61
|
stats[:bad_chunk_record] += 1
|
57
62
|
next
|
58
63
|
end
|
@@ -106,10 +111,15 @@ class Fluent::Plugin::ElasticsearchErrorHandler
|
|
106
111
|
elsif item[write_operation].has_key?('error') && item[write_operation]['error'].has_key?('type')
|
107
112
|
type = item[write_operation]['error']['type']
|
108
113
|
stats[type] += 1
|
109
|
-
retry_stream.add(time, rawrecord)
|
110
114
|
if unrecoverable_error?(type)
|
111
115
|
raise ElasticsearchRequestAbortError, "Rejected Elasticsearch due to #{type}"
|
112
116
|
end
|
117
|
+
if unrecoverable_record_error?(type)
|
118
|
+
@plugin.router.emit_error_event(tag, time, rawrecord, ElasticsearchError.new("#{status} - #{type}: #{reason}"))
|
119
|
+
next
|
120
|
+
else
|
121
|
+
retry_stream.add(time, rawrecord) unless unrecoverable_record_error?(type)
|
122
|
+
end
|
113
123
|
else
|
114
124
|
# When we don't have a type field, something changed in the API
|
115
125
|
# expected return values (ES 2.x)
|
@@ -38,7 +38,7 @@ class TestElasticsearchErrorHandler < Test::Unit::TestCase
|
|
38
38
|
|
39
39
|
def append_record_to_messages(op, meta, header, record, msgs)
|
40
40
|
if record.has_key?('raise') && record['raise']
|
41
|
-
raise
|
41
|
+
raise 'process_message'
|
42
42
|
end
|
43
43
|
return true
|
44
44
|
end
|
@@ -307,7 +307,7 @@ class TestElasticsearchErrorHandler < Test::Unit::TestCase
|
|
307
307
|
def test_retry_error
|
308
308
|
records = []
|
309
309
|
error_records = Hash.new(false)
|
310
|
-
error_records.merge!({0=>true, 4=>true
|
310
|
+
error_records.merge!({0=>true, 4=>true})
|
311
311
|
10.times do |i|
|
312
312
|
records << {time: 12345, record: {"message"=>"record #{i}","_id"=>i,"raise"=>error_records[i]}}
|
313
313
|
end
|
@@ -391,6 +391,18 @@ class TestElasticsearchErrorHandler < Test::Unit::TestCase
|
|
391
391
|
"reason":"unrecognized error"
|
392
392
|
}
|
393
393
|
}
|
394
|
+
},
|
395
|
+
{
|
396
|
+
"create" : {
|
397
|
+
"_index" : "foo",
|
398
|
+
"_type" : "bar",
|
399
|
+
"_id" : "9",
|
400
|
+
"status" : 500,
|
401
|
+
"error" : {
|
402
|
+
"type" : "json_parse_exception",
|
403
|
+
"reason":"Invalid UTF-8 start byte 0x92\\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@204fe9c9; line: 1, column: 81]"
|
404
|
+
}
|
405
|
+
}
|
394
406
|
}
|
395
407
|
]
|
396
408
|
}))
|
@@ -405,12 +417,12 @@ class TestElasticsearchErrorHandler < Test::Unit::TestCase
|
|
405
417
|
next unless e.respond_to?(:retry_stream)
|
406
418
|
e.retry_stream.each {|time, record| records << record}
|
407
419
|
end
|
408
|
-
assert_equal 2, records.length
|
409
|
-
assert_equal 2, records[0]['_id']
|
410
|
-
assert_equal 8, records[1]['_id']
|
420
|
+
assert_equal 2, records.length, "Exp. retry_stream to contain records"
|
421
|
+
assert_equal 2, records[0]['_id'], "Exp record with given ID to in retry_stream"
|
422
|
+
assert_equal 8, records[1]['_id'], "Exp record with given ID to in retry_stream"
|
411
423
|
error_ids = @plugin.error_events.collect {|h| h[:record]['_id']}
|
412
|
-
assert_equal
|
413
|
-
assert_equal [5, 6, 7], error_ids
|
424
|
+
assert_equal 4, error_ids.length, "Exp. a certain number of records to be dropped from retry_stream"
|
425
|
+
assert_equal [5, 6, 7, 9], error_ids, "Exp. specific records to be dropped from retry_stream"
|
414
426
|
@plugin.error_events.collect {|h| h[:error]}.each do |e|
|
415
427
|
assert_true e.respond_to?(:backtrace)
|
416
428
|
end
|
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.0.
|
4
|
+
version: 5.0.5
|
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-06-
|
13
|
+
date: 2021-06-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: fluentd
|