fluent-plugin-vmware-loginsight 1.4.0 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 198031c3139a6f62c7fff502b82487c3f113cb9e0fc77540c9ac08635b3c9a09
4
- data.tar.gz: f4f0b05c508be86e532c2d11a3a77523021b795a02478b68659e9f211ca22e81
3
+ metadata.gz: e3aff37b5e1d472a2dfdb139d313a6558d021c8000f3bd3e2d5b6cf4a11d87e7
4
+ data.tar.gz: 2798b507094394c297f7134ff2fed20ba75c586b3693bfd93245b2ddf4c21406
5
5
  SHA512:
6
- metadata.gz: c47fedca8aeb8945d089b0ba347fd5c304ed099f543954caa1def1daf6545eedff1ecf443b30799a75bdd5b5a9577e67fe591c236c65999ac7cd830c29eb51ee
7
- data.tar.gz: 6c9184bb6e8092f7995a078424995a94b92a417141dc15be5ececb639e7cd6a3432de1d4fd8fbfc1a6d73343c291f38311c002bd9c30bbd50b331bc65db10b15
6
+ metadata.gz: 1d2a2405b82847309bd1852ab87c88781119f0901c26e452628a322714369e40c9b3e65a493c07762a5f142d432acba927ba454a8016ce271cfc5e19df24bf6e
7
+ data.tar.gz: 03ed49a376b299f5bbe3a0e18986a4e148aeb0425377ae138ea9e915d65abfdeb3a69fef7cf0a9c7dc5fdbaf71005f12fdb30f2b8acec862833dc20da0d3b7a1
@@ -9,10 +9,10 @@ jobs:
9
9
 
10
10
  steps:
11
11
  - uses: actions/checkout@v2
12
- - name: Set up Ruby 2.6
12
+ - name: Set up Ruby 3.0
13
13
  uses: actions/setup-ruby@v1
14
14
  with:
15
- ruby-version: 2.6.x
15
+ ruby-version: 3.0
16
16
 
17
17
  - name: Publish to GPR
18
18
  run: |
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.4.2 - Oct 19, 2023
4
+
5
+ * Fixed the issue with the timestamp ignoring milliseconds ([#33](https://github.com/vmware/fluent-plugin-vmware-loginsight/pull/33))
6
+
7
+ ## v1.4.1 - Apr 25, 2023
8
+
9
+ * Add support for gzip compression ([#17](https://github.com/vmware/fluent-plugin-vmware-loginsight/pull/17),[#18](https://github.com/vmware/fluent-plugin-vmware-loginsight/pull/18), [@toddc-vmware](https://github.com/toddc-vmware))
10
+ * Add support for multi-worker ([#27](https://github.com/vmware/fluent-plugin-vmware-loginsight/pull/27),[@yajith](https://github.com/yajith))
11
+ * Update default batch size to 4MB from 512KB ([#28](https://github.com/vmware/fluent-plugin-vmware-loginsight/pull/28), [@mohitevishal](https://github.com/mohitevishal))
12
+
3
13
  ## v1.4.0 - Mar 07, 2023
4
14
 
5
15
  * Base Photon image has been updated to photon:4.0-20230227
data/Dockerfile CHANGED
@@ -45,7 +45,7 @@ RUN buildDeps="\
45
45
  && gem install --norc --no-document fluent-plugin-kubernetes_metadata_filter \
46
46
  #
47
47
  # Install Log Insight plugin
48
- && gem install --norc --no-document -v 1.4.0 fluent-plugin-vmware-loginsight \
48
+ && gem install --norc --no-document -v 1.4.1 fluent-plugin-vmware-loginsight \
49
49
  #
50
50
  # Install jemalloc 5.3.0
51
51
  && curl -L --output /tmp/jemalloc-5.3.0.tar.bz2 https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2 \
data/README.md CHANGED
@@ -131,7 +131,7 @@ request_timeout, :time, :default => 5
131
131
  http_conn_debug, :bool, :default => false :: Valid Value: true | false
132
132
 
133
133
  # Number of bytes per post request
134
- max_batch_size, :integer, :default => 512000
134
+ max_batch_size, :integer, :default => 4000000
135
135
 
136
136
  # Simple rate limiting: ignore any records within `rate_limit_msec` since the last one
137
137
  rate_limit_msec, :integer, :default => 0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.0
1
+ 1.4.2
@@ -12,6 +12,7 @@
12
12
  require 'fluent/plugin/output'
13
13
  require 'json'
14
14
  require 'net/http'
15
+ require 'zlib'
15
16
  require 'uri'
16
17
 
17
18
  module Fluent::Plugin
@@ -44,13 +45,15 @@ module Fluent::Plugin
44
45
  # HTTP method
45
46
  # post | put
46
47
  config_param :http_method, :string, :default => :post
48
+ config_param :http_compress, :bool, :default => true
47
49
  # form | json
48
50
  config_param :serializer, :string, :default => :json
49
51
  config_param :request_retries, :integer, :default => 3
50
52
  config_param :request_timeout, :time, :default => 5
51
53
  config_param :http_conn_debug, :bool, :default => false
52
- # in bytes
53
- config_param :max_batch_size, :integer, :default => 512000
54
+ # Log events batched per request.
55
+ # in bytes | default ~4MB
56
+ config_param :max_batch_size, :integer, :default => 4000000
54
57
 
55
58
  # Simple rate limiting: ignore any records within `rate_limit_msec`
56
59
  # since the last one.
@@ -114,10 +117,17 @@ module Fluent::Plugin
114
117
  url
115
118
  end
116
119
 
120
+ def multi_workers_ready?
121
+ true
122
+ end
123
+
117
124
  def set_header(req)
118
125
  if @serializer == 'json'
119
126
  set_json_header(req)
120
127
  end
128
+ if @http_compress
129
+ set_gzip_header(req)
130
+ end
121
131
  req
122
132
  end
123
133
 
@@ -126,6 +136,11 @@ module Fluent::Plugin
126
136
  req
127
137
  end
128
138
 
139
+ def set_gzip_header(req)
140
+ req['Content-Encoding'] = 'gzip'
141
+ req
142
+ end
143
+
129
144
  def shorten_key(key)
130
145
  # LI doesn't allow some characters in field 'name'
131
146
  # like '/', '-', '\', '.', etc. so replace them with @flatten_hashes_separator
@@ -192,7 +207,7 @@ module Fluent::Plugin
192
207
  event = {
193
208
  "fields" => fields,
194
209
  "text" => log.gsub(/^$\n/, ''),
195
- "timestamp" => time * 1000
210
+ "timestamp" => (time.to_f * 1000).floor()
196
211
  }
197
212
  event
198
213
  end
@@ -219,13 +234,23 @@ module Fluent::Plugin
219
234
  ret
220
235
  end
221
236
 
237
+ def get_body(req)
238
+ body = ""
239
+ if @http_compress
240
+ gzip_body = Zlib::GzipReader.new(StringIO.new(req.body.to_s))
241
+ body = gzip_body.read
242
+ else
243
+ body = req.body
244
+ end
245
+ return body[1..1024]
246
+ end
247
+
222
248
  def send_request(req, uri)
223
249
  is_rate_limited = (@rate_limit_msec != 0 and not @last_request_time.nil?)
224
250
  if is_rate_limited and ((Time.now.to_f - @last_request_time) * 1000.0 < @rate_limit_msec)
225
251
  $log.info('Dropped request due to rate limiting')
226
252
  return
227
253
  end
228
-
229
254
  if @auth and @auth.to_s.eql? "basic"
230
255
  req.basic_auth(@username, @password)
231
256
  end
@@ -253,7 +278,7 @@ module Fluent::Plugin
253
278
  # log-container logs to LI as well, you may end up in a cycle.
254
279
  # TODO handle the cyclic case at plugin level if possible.
255
280
  # $log.warn "Net::HTTP.#{req.method.capitalize} raises exception: " \
256
- # "#{e.class}, '#{e.message}', \n Request: #{req.body[1..1024]}"
281
+ # "#{e.class}, '#{e.message}', \n Request: #{get_body(req)}"
257
282
  retry unless (retries -= 1).zero?
258
283
  raise e if @raise_on_error
259
284
  else
@@ -267,17 +292,27 @@ module Fluent::Plugin
267
292
  end
268
293
  # ditto cyclic warning
269
294
  # $log.warn "Failed to #{req.method} #{uri}\n(#{res_summary})\n" \
270
- # "Request Size: #{req.body.size} Request Body: #{req.body[1..1024]}"
295
+ # "Request Size: #{req.body.size} Request Body: #{get_body(req)}"
271
296
  end #end unless
272
297
  end # end begin
273
298
  end # end send_request
274
299
 
300
+ def set_body(req, event_req)
301
+ if @http_compress
302
+ gzip_body = Zlib::GzipWriter.new(StringIO.new)
303
+ gzip_body << event_req.to_json
304
+ req.body = gzip_body.close.string
305
+ else
306
+ req.body = event_req.to_json
307
+ end
308
+ end
309
+
275
310
  def send_events(uri, events)
276
311
  req = Net::HTTP.const_get(@http_method.to_s.capitalize).new(uri.path)
277
312
  event_req = {
278
313
  "events" => events
279
314
  }
280
- req.body = event_req.to_json
315
+ set_body(req, event_req)
281
316
  set_header(req)
282
317
  send_request(req, uri)
283
318
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-vmware-loginsight
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vishal Mohite
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-03-16 00:00:00.000000000 Z
13
+ date: 2023-10-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -121,8 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  requirements: []
124
- rubyforge_project:
125
- rubygems_version: 2.7.6
124
+ rubygems_version: 3.2.3
126
125
  signing_key:
127
126
  specification_version: 4
128
127
  summary: Fluend output plugin to forward logs to VMware Aria Operations For Logs