fluent-plugin-logzio 0.0.19 → 0.0.20

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
  SHA1:
3
- metadata.gz: 17485e8da5dcd5e20352ee01f41f480d4158027a
4
- data.tar.gz: f9255f6ae60a9a481352b2d1939838b52b5cf5e1
3
+ metadata.gz: 00712efa48ad7c34e8001348827d45f860bdd10b
4
+ data.tar.gz: 10310e5d634b547ddf0dc5d4879eea68f26d11a9
5
5
  SHA512:
6
- metadata.gz: de25eaeb14be8b1e583640e1eab772a0b71c036cc268a41996efff4d31a6bd89f22eb7f2a5b0bfe67af802ce8585508e3782e80169bf6063146a08e22c0c807c
7
- data.tar.gz: a089634c8368a3acaef3451b32278e9e9e391035d6790450a77fd7d53e6cff6b727f24a699ab22665eda8afb25c927ea5087fb88ef3b765d03e18629ecee9019
6
+ metadata.gz: f7c1125f92c1053390301557b1d5b35febabaaab47cf81e0f6ac52267fbe84fd8e73190690c50fe1df3a094d8049ff926b1c108d3d544a4eb25e0a07e37095b2
7
+ data.tar.gz: d6603716d9b97514cf611358d212788a21bad1436e12a20427340ac5d1404f5b2d7470123c92d10ba11a129bf3b0be7724364caac76a81e205c471623902bbdf
data/README.md CHANGED
@@ -71,9 +71,11 @@ This is an **example** only. Your needs in production may vary!
71
71
  * **bulk_limit_warning_limit** Limit to the size of the Logz.io warning message when a record exceeds bulk_limit to prevent a recursion when Fluent warnings are sent to the Logz.io output. Defaults to nil (no truncation).
72
72
  * **proxy_uri** Your proxy uri. Default is nil
73
73
  * **proxy_cert** Your proxy cert. Default is nil
74
+ * **gzip** should the plugin ship the logs in gzip compression. Default is false
74
75
 
75
76
 
76
77
  ## Release Notes
78
+ - 0.0.20: Support gzip compression
77
79
  - 0.0.18: Support proxy_uri and proxy_cert in the configuration file. Put logzio output plugin class under Fluent::Plugin module and thus work with multi workers.
78
80
  - 0.0.17: Optional truncate log messages when they are exceeding bulk size in warning logs
79
81
  - 0.0.16: More fluentD 1.0+ adjustments
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'fluent-plugin-logzio'
7
- s.version = '0.0.19'
7
+ s.version = '0.0.20'
8
8
  s.authors = ['Yury Kotov', 'Roi Rav-Hon', 'Arcadiy Ivanov']
9
9
  s.email = ['bairkan@gmail.com', 'roi@logz.io', 'arcadiy@ivanov.biz']
10
10
  s.homepage = 'https://github.com/logzio/fluent-plugin-logzio'
@@ -1,5 +1,7 @@
1
1
  require 'time'
2
2
  require 'fluent/plugin/output'
3
+ require 'zlib'
4
+ require 'stringio'
3
5
 
4
6
  module Fluent::Plugin
5
7
  class LogzioOutputBuffered < Output
@@ -18,6 +20,7 @@ module Fluent::Plugin
18
20
  config_param :output_tags_fieldname, :string, default: 'fluentd_tags'
19
21
  config_param :proxy_uri, :string, default: nil
20
22
  config_param :proxy_cert, :string, default: nil
23
+ config_param :gzip, :bool, default: false # False for backward compatibility
21
24
 
22
25
  def configure(conf)
23
26
  super
@@ -43,6 +46,9 @@ module Fluent::Plugin
43
46
  @uri = URI @endpoint_url
44
47
  @http = Net::HTTP::Persistent.new 'fluent-plugin-logzio', :ENV
45
48
  @http.headers['Content-Type'] = 'text/plain'
49
+ if @gzip
50
+ @http.headers['Content-Encoding'] = 'gzip'
51
+ end
46
52
  @http.idle_timeout = @http_idle_timeout
47
53
  @http.socket_options << [Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, 1]
48
54
 
@@ -122,7 +128,9 @@ module Fluent::Plugin
122
128
 
123
129
  # Logz.io bulk http endpoint expecting log line with \n delimiter
124
130
  post.body = bulk_records.join("\n")
125
-
131
+ if gzip
132
+ post.body = compress(post.body)
133
+ end
126
134
  sleep_interval = @retry_sleep
127
135
 
128
136
  begin
@@ -163,5 +171,13 @@ module Fluent::Plugin
163
171
  log.error "Got unexpected exception! Here: #{e}"
164
172
  end
165
173
  end
174
+
175
+ def compress(string)
176
+ wio = StringIO.new("w")
177
+ w_gz = Zlib::GzipWriter.new(wio)
178
+ w_gz.write(string)
179
+ w_gz.close
180
+ wio.string
181
+ end
166
182
  end
167
183
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-logzio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yury Kotov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-12-17 00:00:00.000000000 Z
13
+ date: 2019-03-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: net-http-persistent