fluent-plugin-elasticsearch 3.3.0 → 3.3.1
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 +4 -0
- data/README.md +8 -1
- data/fluent-plugin-elasticsearch.gemspec +1 -1
- data/lib/fluent/plugin/out_elasticsearch.rb +4 -0
- data/test/plugin/test_out_elasticsearch.rb +55 -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: 31cc9563debdbede8ae6e51e6e43089150c5ce736457433a9f4e8dc5652fb489
|
4
|
+
data.tar.gz: 021c1bde5bc10ffcd24536a7fcda38151dcc2508edcfb87b973dee8cf8f1fdd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: faca5fb42a3a126f27b864a48588a1fd918b645b16287500b2793150ed83fe5d2378f1c0527917fe33309a9fcb7af0f7645190700043f30fd8a02d3fd04ddcf6
|
7
|
+
data.tar.gz: 363df0da34ce21414a993c4464ba60766c3e0b0dd171b61674d6bd8850d3ca8d4055563d231439b1004cfc5aaa0b54f311e9002a6689c938960f011ab70e051a
|
data/History.md
CHANGED
data/README.md
CHANGED
@@ -81,6 +81,7 @@ Current maintainers: @cosmo0920
|
|
81
81
|
+ [Placeholders](#placeholders)
|
82
82
|
+ [Multi workers](#multi-workers)
|
83
83
|
+ [log_es_400_reason](#log_es_400_reason)
|
84
|
+
+ [suppress_doc_wrap](#suppress_doc_wrap)
|
84
85
|
* [Troubleshooting](#troubleshooting)
|
85
86
|
+ [Cannot send events to elasticsearch](#cannot-send-events-to-elasticsearch)
|
86
87
|
+ [Cannot see detailed failure log](#cannot-see-detailed-failure-log)
|
@@ -1025,6 +1026,12 @@ By default, the error logger won't record the reason for a 400 error from the El
|
|
1025
1026
|
|
1026
1027
|
Default value is `false`.
|
1027
1028
|
|
1029
|
+
## suppress_doc_wrap
|
1030
|
+
|
1031
|
+
By default, record body is wrapped by 'doc'. This behavior can not handle update script requests. You can set this to suppress doc wrapping and allow record body to be untouched.
|
1032
|
+
|
1033
|
+
Default value is `false`.
|
1034
|
+
|
1028
1035
|
## Troubleshooting
|
1029
1036
|
|
1030
1037
|
### Cannot send events to Elasticsearch
|
@@ -1265,7 +1272,7 @@ The following configuration uses label:
|
|
1265
1272
|
fluent-plugin-elasticsearch default behavior has a possibility to cause events traffic jam.
|
1266
1273
|
When users use `flush_thread_count` = 1, ES plugin retries to send events if connection errors are disappeared.
|
1267
1274
|
|
1268
|
-
To prevent the following warning and sending events blocking, you must specify `flush_thread_count`
|
1275
|
+
To prevent the following warning and sending events blocking, you must specify `flush_thread_count` >= 2:
|
1269
1276
|
|
1270
1277
|
```log
|
1271
1278
|
2018-12-24 14:32:06 +0900 [warn]: #0 To prevent events traffic jam, you should specify 2 or more 'flush_thread_count'.
|
@@ -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.3.
|
6
|
+
s.version = '3.3.1'
|
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}
|
@@ -132,6 +132,7 @@ EOC
|
|
132
132
|
config_param :default_elasticsearch_version, :integer, :default => DEFAULT_ELASTICSEARCH_VERSION
|
133
133
|
config_param :log_es_400_reason, :bool, :default => false
|
134
134
|
config_param :custom_headers, :hash, :default => {}
|
135
|
+
config_param :suppress_doc_wrap, :bool, :default => false
|
135
136
|
|
136
137
|
config_section :buffer do
|
137
138
|
config_set_default :@type, DEFAULT_BUFFER_TYPE
|
@@ -468,6 +469,9 @@ EOC
|
|
468
469
|
|
469
470
|
def update_body(record, op)
|
470
471
|
update = remove_keys(record)
|
472
|
+
if @suppress_doc_wrap
|
473
|
+
return update
|
474
|
+
end
|
471
475
|
body = {"doc".freeze => update}
|
472
476
|
if op == UPSERT_OP
|
473
477
|
if update == record
|
@@ -2510,4 +2510,59 @@ class ElasticsearchOutput < Test::Unit::TestCase
|
|
2510
2510
|
assert_logs_include_compare_size(1, "<=", log, /In Fluent::Plugin::ElasticsearchSimpleSniffer hosts/)
|
2511
2511
|
end
|
2512
2512
|
|
2513
|
+
def test_suppress_doc_wrap
|
2514
|
+
driver.configure('write_operation update
|
2515
|
+
id_key id
|
2516
|
+
remove_keys id
|
2517
|
+
suppress_doc_wrap true')
|
2518
|
+
stub_elastic
|
2519
|
+
doc_body = {'field' => 'value'}
|
2520
|
+
script_body = {'source' => 'ctx._source.counter += params.param1',
|
2521
|
+
'lang' => 'painless',
|
2522
|
+
'params' => {'param1' => 1}}
|
2523
|
+
upsert_body = {'counter' => 1}
|
2524
|
+
driver.run(default_tag: 'test') do
|
2525
|
+
driver.feed('id' => 1, 'doc' => doc_body)
|
2526
|
+
driver.feed('id' => 2, 'script' => script_body, 'upsert' => upsert_body)
|
2527
|
+
end
|
2528
|
+
assert(
|
2529
|
+
index_cmds[1] == {'doc' => doc_body}
|
2530
|
+
)
|
2531
|
+
assert(
|
2532
|
+
index_cmds[3] == {
|
2533
|
+
'script' => script_body,
|
2534
|
+
'upsert' => upsert_body
|
2535
|
+
}
|
2536
|
+
)
|
2537
|
+
end
|
2538
|
+
|
2539
|
+
def test_suppress_doc_wrap_should_handle_record_as_is_at_upsert
|
2540
|
+
driver.configure('write_operation upsert
|
2541
|
+
id_key id
|
2542
|
+
remove_keys id
|
2543
|
+
suppress_doc_wrap true')
|
2544
|
+
stub_elastic
|
2545
|
+
doc_body = {'field' => 'value'}
|
2546
|
+
script_body = {'source' => 'ctx._source.counter += params.param1',
|
2547
|
+
'lang' => 'painless',
|
2548
|
+
'params' => {'param1' => 1}}
|
2549
|
+
upsert_body = {'counter' => 1}
|
2550
|
+
driver.run(default_tag: 'test') do
|
2551
|
+
driver.feed('id' => 1, 'doc' => doc_body, 'doc_as_upsert' => true)
|
2552
|
+
driver.feed('id' => 2, 'script' => script_body, 'upsert' => upsert_body)
|
2553
|
+
end
|
2554
|
+
assert(
|
2555
|
+
index_cmds[1] == {
|
2556
|
+
'doc' => doc_body,
|
2557
|
+
'doc_as_upsert' => true
|
2558
|
+
}
|
2559
|
+
)
|
2560
|
+
assert(
|
2561
|
+
index_cmds[3] == {
|
2562
|
+
'script' => script_body,
|
2563
|
+
'upsert' => upsert_body
|
2564
|
+
}
|
2565
|
+
)
|
2566
|
+
end
|
2567
|
+
|
2513
2568
|
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: 3.3.
|
4
|
+
version: 3.3.1
|
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-03-
|
12
|
+
date: 2019-03-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|