fluent-plugin-elasticsearch 2.6.1 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +3 -0
- data/README.md +11 -0
- data/fluent-plugin-elasticsearch.gemspec +1 -1
- data/lib/fluent/plugin/out_elasticsearch.rb +2 -1
- data/lib/fluent/plugin/out_elasticsearch_dynamic.rb +1 -1
- data/test/plugin/test_out_elasticsearch.rb +19 -1
- data/test/plugin/test_out_elasticsearch_dynamic.rb +19 -1
- 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: 6c45d1357073cd62a59770c94e106099a367b504e4fcc306868a51cad18b76a1
|
4
|
+
data.tar.gz: ffeb4647996e9da73b432d7b9baae5766e4973801b7ee59e097e26bf927aff38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82bc86a0116891984e93587d77f39fcd8e86112a6688bcc10e52b99114a0d98bcade90643083815f0929533802cb956ac1f3aa8fa150cf7bba4e2d55094fb9f1
|
7
|
+
data.tar.gz: f74034825181ddfa92968de7eaa041ff35e17797a5aa496e396f645bae25f57ee5b9eff5cc86bd1c82ea0fc306f5991232fef5ff927d06130b5f61229ec40d29
|
data/History.md
CHANGED
data/README.md
CHANGED
@@ -51,6 +51,7 @@ Current maintainers: @cosmo0920
|
|
51
51
|
+ [time_parse_error_tag](#time_parse_error_tag)
|
52
52
|
+ [reconnect_on_error](#reconnect_on_error)
|
53
53
|
+ [with_transporter_log](#with_transporter_log)
|
54
|
+
+ [content_type](#content_type)
|
54
55
|
+ [Client/host certificate options](#clienthost-certificate-options)
|
55
56
|
+ [Proxy Support](#proxy-support)
|
56
57
|
+ [Buffer options](#buffer-options)
|
@@ -570,6 +571,16 @@ We recommend to set this true if you start to debug this plugin.
|
|
570
571
|
with_transporter_log true
|
571
572
|
```
|
572
573
|
|
574
|
+
### content_type
|
575
|
+
|
576
|
+
With `content_type application/json`, elasticsearch plugin adds `application/json` as `Content-Type` in payload.
|
577
|
+
|
578
|
+
Default value is `application/x-ndjson` which is encourage to use Elasticsearch bulk request.
|
579
|
+
|
580
|
+
```
|
581
|
+
content_type application/json
|
582
|
+
```
|
583
|
+
|
573
584
|
### Client/host certificate options
|
574
585
|
|
575
586
|
Need to verify Elasticsearch's certificate? You can use the following parameter to specify a CA instead of using an environment variable.
|
@@ -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 = '2.
|
6
|
+
s.version = '2.7.0'
|
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}
|
@@ -75,6 +75,7 @@ module Fluent::Plugin
|
|
75
75
|
config_param :reconnect_on_error, :bool, :default => false
|
76
76
|
config_param :pipeline, :string, :default => nil
|
77
77
|
config_param :with_transporter_log, :bool, :default => false
|
78
|
+
config_param :content_type, :enum, list: [:"application/json", :"application/x-ndjson"], :default => :"application/x-ndjson"
|
78
79
|
|
79
80
|
config_section :buffer do
|
80
81
|
config_set_default :@type, DEFAULT_BUFFER_TYPE
|
@@ -207,7 +208,7 @@ module Fluent::Plugin
|
|
207
208
|
retry_on_failure: 5,
|
208
209
|
logger: @transport_logger,
|
209
210
|
transport_options: {
|
210
|
-
headers: { 'Content-Type' =>
|
211
|
+
headers: { 'Content-Type' => @content_type.to_s },
|
211
212
|
request: { timeout: @request_timeout },
|
212
213
|
ssl: { verify: @ssl_verify, ca_file: @ca_file, version: @ssl_version }
|
213
214
|
}
|
@@ -54,7 +54,7 @@ module Fluent::Plugin
|
|
54
54
|
retry_on_failure: 5,
|
55
55
|
logger: @transport_logger,
|
56
56
|
transport_options: {
|
57
|
-
headers: { 'Content-Type' =>
|
57
|
+
headers: { 'Content-Type' => @content_type.to_s },
|
58
58
|
request: { timeout: @request_timeout },
|
59
59
|
ssl: { verify: @ssl_verify, ca_file: @ca_file }
|
60
60
|
}
|
@@ -212,6 +212,24 @@ class ElasticsearchOutput < Test::Unit::TestCase
|
|
212
212
|
assert_nil instance.client_cert
|
213
213
|
assert_nil instance.client_key_pass
|
214
214
|
assert_false instance.with_transporter_log
|
215
|
+
assert_equal :"application/x-ndjson", instance.content_type
|
216
|
+
end
|
217
|
+
|
218
|
+
test 'configure Content-Type' do
|
219
|
+
config = %{
|
220
|
+
content_type application/json
|
221
|
+
}
|
222
|
+
instance = driver(config).instance
|
223
|
+
assert_equal :"application/json", instance.content_type
|
224
|
+
end
|
225
|
+
|
226
|
+
test 'invalid Content-Type' do
|
227
|
+
config = %{
|
228
|
+
content_type nonexistent/invalid
|
229
|
+
}
|
230
|
+
assert_raise(Fluent::ConfigError) {
|
231
|
+
instance = driver(config).instance
|
232
|
+
}
|
215
233
|
end
|
216
234
|
|
217
235
|
test 'lack of tag in chunk_keys' do
|
@@ -625,7 +643,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
|
|
625
643
|
stub_request(:head, "http://localhost:9200/").
|
626
644
|
to_return(:status => 200, :body => "", :headers => {})
|
627
645
|
elastic_request = stub_request(:post, "http://localhost:9200/_bulk").
|
628
|
-
with(headers: { "Content-Type" => "application/
|
646
|
+
with(headers: { "Content-Type" => "application/x-ndjson" })
|
629
647
|
driver.run(default_tag: 'test') do
|
630
648
|
driver.feed(sample_record)
|
631
649
|
end
|
@@ -85,6 +85,24 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
|
|
85
85
|
assert_nil instance.client_cert
|
86
86
|
assert_nil instance.client_key_pass
|
87
87
|
assert_false instance.with_transporter_log
|
88
|
+
assert_equal :"application/x-ndjson", instance.content_type
|
89
|
+
end
|
90
|
+
|
91
|
+
test 'configure Content-Type' do
|
92
|
+
config = %{
|
93
|
+
content_type application/json
|
94
|
+
}
|
95
|
+
instance = driver(config).instance
|
96
|
+
assert_equal :"application/json", instance.content_type
|
97
|
+
end
|
98
|
+
|
99
|
+
test 'invalid Content-Type' do
|
100
|
+
config = %{
|
101
|
+
content_type nonexistent/invalid
|
102
|
+
}
|
103
|
+
assert_raise(Fluent::ConfigError) {
|
104
|
+
instance = driver(config).instance
|
105
|
+
}
|
88
106
|
end
|
89
107
|
|
90
108
|
def test_defaults
|
@@ -220,7 +238,7 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
|
|
220
238
|
stub_request(:head, "http://localhost:9200/").
|
221
239
|
to_return(:status => 200, :body => "", :headers => {})
|
222
240
|
elastic_request = stub_request(:post, "http://localhost:9200/_bulk").
|
223
|
-
with(headers: { "Content-Type" => "application/
|
241
|
+
with(headers: { "Content-Type" => "application/x-ndjson" })
|
224
242
|
driver.run(default_tag: 'test') do
|
225
243
|
driver.feed(sample_record)
|
226
244
|
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: 2.
|
4
|
+
version: 2.7.0
|
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: 2018-02-
|
12
|
+
date: 2018-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|