fluent-plugin-elasticsearch2 3.5.6 → 3.5.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49e4874ac483b25c9c52b02fa8fad124b26e405b7a72fbb9d062194a133b6306
4
- data.tar.gz: 913026e3e68e16dc7d8fdd688b283965d4a4e8262d7259d0b2e18015621c68a7
3
+ metadata.gz: eba3a47fd42092979a380189d399b383ca84b8cf5b9f29aacff244018051283b
4
+ data.tar.gz: ef9195d6d321b15fa63e8aef5d8f3cfbe69611a4352045083eff152384156be0
5
5
  SHA512:
6
- metadata.gz: 52434c4ebb2e9297fef7a5f48fecc21390a3c5900c8cb4cb2eef5b99a7db2cff035a6b58bbd911045a54211636e788aed7a0f1791e4e3d904631a496da1830ba
7
- data.tar.gz: '0912fde555be7024ee086616acd163073bb6047a1659ff9b14b1d15438183c5a8bcc73d0a06fb033bca5ee57b4af298c463eb2766e06d84a49061414b3f8af93'
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'
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
- response = client(info.host).bulk body: data, index: info.index
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']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-elasticsearch2
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.6
4
+ version: 3.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - diogo