fluent-plugin-vmware-loginsight 1.4.0 → 1.4.1
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 +4 -4
- data/.github/workflows/gem-push.yml +2 -2
- data/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/fluent/plugin/out_vmware_loginsight.rb +41 -6
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1f7c396ae7d9694669619e530a495192cb3ba56d6eb62838d27c5333d6a8f2a
|
4
|
+
data.tar.gz: ea053415b736253ecae294ca26930dd3408755498ec38e2cbdea68d3c31b698b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd8dda762a1fd5d72caa1bebbbe7ecea69e79685df2bb3a22bb79730a61197f82f7dcced544a4f01075cfaf197e3eae63a0d739aff5834878285b42612444f39
|
7
|
+
data.tar.gz: 3b5395db3fa3b7125ac6144d23ad789e349de49c20577cd40e87a7501c5e39c057285a22165d115fdf34adc988ab754532c299b7d8fffb0aa908883119f0060b
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v1.4.1 - Apr 25, 2023
|
4
|
+
|
5
|
+
* 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))
|
6
|
+
* Add support for multi-worker ([#27](https://github.com/vmware/fluent-plugin-vmware-loginsight/pull/27),[@yajith](https://github.com/yajith))
|
7
|
+
* Update default batch size to 4MB from 512KB ([#28](https://github.com/vmware/fluent-plugin-vmware-loginsight/pull/28), [@mohitevishal](https://github.com/mohitevishal))
|
8
|
+
|
3
9
|
## v1.4.0 - Mar 07, 2023
|
4
10
|
|
5
11
|
* Base Photon image has been updated to photon:4.0-20230227
|
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 =>
|
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.
|
1
|
+
1.4.1
|
@@ -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
|
-
#
|
53
|
-
|
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
|
@@ -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
|
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
|
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
|
315
|
+
set_body(req, event_req)
|
281
316
|
set_header(req)
|
282
317
|
send_request(req, uri)
|
283
318
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-vmware-loginsight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vishal Mohite
|
8
8
|
- Chris Todd
|
9
9
|
- Samvel Israelyan
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-
|
13
|
+
date: 2023-04-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -106,7 +106,7 @@ homepage: https://github.com/vmware/fluent-plugin-vmware-loginsight
|
|
106
106
|
licenses:
|
107
107
|
- MIT
|
108
108
|
metadata: {}
|
109
|
-
post_install_message:
|
109
|
+
post_install_message:
|
110
110
|
rdoc_options: []
|
111
111
|
require_paths:
|
112
112
|
- lib
|
@@ -121,9 +121,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
|
-
|
125
|
-
|
126
|
-
signing_key:
|
124
|
+
rubygems_version: 3.2.3
|
125
|
+
signing_key:
|
127
126
|
specification_version: 4
|
128
127
|
summary: Fluend output plugin to forward logs to VMware Aria Operations For Logs
|
129
128
|
test_files:
|