fluent-plugin-elasticsearch2 3.5.6 → 3.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fluent-plugin-elasticsearch.gemspec +1 -1
- data/lib/fluent/plugin/out_elasticsearch2.rb +16 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eba3a47fd42092979a380189d399b383ca84b8cf5b9f29aacff244018051283b
|
4
|
+
data.tar.gz: ef9195d6d321b15fa63e8aef5d8f3cfbe69611a4352045083eff152384156be0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f09dfae276dacd62c5769cce54b2cf38fddd08708a90a50141f3767120cdf5aaf9501da458a7c46dd27955acaeac7728fd737cd456a4002ee33e3725a60f484
|
7
|
+
data.tar.gz: 55c126acf25b7d94e77e51a0833675a58873c828d3a6092aaefa67cbd8cbe63630b23af8c141a001877a9e9b5a6bdd2075a6b01c7600120b3782071a03ac25d5
|
@@ -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-elasticsearch2'
|
6
|
-
s.version = '3.5.
|
6
|
+
s.version = '3.5.7'
|
7
7
|
s.authors = ['diogo', 'pitr']
|
8
8
|
s.email = ['pitr.vern@gmail.com', 'me@diogoterror.com']
|
9
9
|
s.description = "%Elasticsearch output plugin for Fluent event collector"
|
@@ -14,6 +14,7 @@ require 'fluent/event'
|
|
14
14
|
require 'fluent/error'
|
15
15
|
require 'fluent/time'
|
16
16
|
require 'fluent/log-ext'
|
17
|
+
require 'zlib'
|
17
18
|
require_relative 'elasticsearch_constants'
|
18
19
|
require_relative 'elasticsearch_error'
|
19
20
|
require_relative 'elasticsearch_error_handler'
|
@@ -142,6 +143,7 @@ EOC
|
|
142
143
|
config_param :ignore_exceptions, :array, :default => [], value_type: :string, :desc => "Ignorable exception list"
|
143
144
|
config_param :exception_backup, :bool, :default => true, :desc => "Chunk backup flag when ignore exception occured"
|
144
145
|
config_param :bulk_message_request_threshold, :size, :default => TARGET_BULK_BYTES
|
146
|
+
config_param :compression, :bool, :default => false
|
145
147
|
|
146
148
|
config_section :buffer do
|
147
149
|
config_set_default :@type, DEFAULT_BUFFER_TYPE
|
@@ -733,13 +735,25 @@ EOC
|
|
733
735
|
[parent_object, path[-1]]
|
734
736
|
end
|
735
737
|
|
738
|
+
def gzip(string)
|
739
|
+
wio = StringIO.new("w")
|
740
|
+
w_gz = Zlib::GzipWriter.new(wio, strategy = Zlib::BEST_SPEED)
|
741
|
+
w_gz.write(string)
|
742
|
+
w_gz.close
|
743
|
+
wio.string
|
744
|
+
end
|
745
|
+
|
736
746
|
# send_bulk given a specific bulk request, the original tag,
|
737
747
|
# chunk, and bulk_message_count
|
738
748
|
def send_bulk(data, tag, chunk, bulk_message_count, extracted_values, info)
|
739
749
|
begin
|
740
|
-
|
741
750
|
log.on_trace { log.trace "bulk request: #{data}" }
|
742
|
-
|
751
|
+
if @compression
|
752
|
+
prepared_data = gzip(data)
|
753
|
+
else
|
754
|
+
prepared_data = data
|
755
|
+
end
|
756
|
+
response = client(info.host).bulk body: prepared_data, index: info.index
|
743
757
|
log.on_trace { log.trace "bulk response: #{response}" }
|
744
758
|
|
745
759
|
if response['errors']
|