logstash-input-google_pubsub_compressed_batches 1.2.5 → 1.2.6

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.

Potentially problematic release.


This version of logstash-input-google_pubsub_compressed_batches might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93658a8c341decdeadf6a727cc398e3a2ed8a6fd8fa6a3f4a74db5fa185f4a1b
4
- data.tar.gz: 8a9f67dbb8b555e07d4773a05312df9e59762c875d187c65313aee1a0c771e1e
3
+ metadata.gz: 0f5214fad7a25763f2f63aa0b18fd32b7af81cab156cb104a68d4c37da5af471
4
+ data.tar.gz: 4134da7ea97087725a404cb24939041d7e881a5537a8f019e056882080e238bf
5
5
  SHA512:
6
- metadata.gz: 77bd07a7f38be37c8ab8b07f89cbf805efdae31b37bf1b16200375e6c5cac4bea77303120648f394ab1a5a70037a572309973a2a7e559cf8ed3cbd07a8d43516
7
- data.tar.gz: 88b74105e77cf4aa8dda57819423389908445257e8261ecfb3f95dcc53bbbc607401e8325edc329424da5ce2b4e11d002bea170536ae80e83cd419a3db01f50d
6
+ metadata.gz: c62b860f7bbf8845e648f3a2b24a964bf44a65ff1ee1a7c17e7c7462e2c78a26301bdf8bbffb1ef9129bd95373f285809b8a5e3bcead7ceed03b020a03ad021a
7
+ data.tar.gz: 4525ad91b4e5ed78f5f273995047655a25bd56d5587fe463e61b5a8e464c42db99341164d3eea0bd3708f5b4d9deaca1bc7cd74a666d74440a118ef15a56e855
@@ -1,4 +1,4 @@
1
- ## 1.2.3
1
+ ## 1.2.6
2
2
  - Added support for reading zlib compressed batch
3
3
 
4
4
  ## 1.2.1
@@ -252,11 +252,11 @@ class LogStash::Inputs::GooglePubSub < LogStash::Inputs::Base
252
252
  @logger.debug("Pulling messages from sub '#{@subscription_id}'")
253
253
  handler = MessageReceiver.new do |message|
254
254
  # handle incoming message, then ack/nack the received message
255
- data = message.getData().toStringUtf8()
256
255
  algorithm = message.getAttributesMap()["compression_algorithm"]
257
256
 
258
257
  case algorithm
259
258
  when nil
259
+ data = message.getData().toStringUtf8()
260
260
  @codec.decode(data) do |event|
261
261
  event.set("host", event.get("host") || @host)
262
262
  event.set("[@metadata][pubsub_message]", extract_metadata(message)) if @include_metadata
@@ -264,9 +264,24 @@ class LogStash::Inputs::GooglePubSub < LogStash::Inputs::Base
264
264
  queue << event
265
265
  end
266
266
  when COMPRESSION_ALGORITHM_ZLIB
267
- lines = Zlib::Inflate.inflate(data).split(BATCHED_RECORD_SEPARATOR)
267
+ data = message.getData().toByteArray()
268
+
269
+ # decompress batch
270
+ bais = java.io.ByteArrayInputStream.new(data)
271
+ iis = java.util.zip.InflaterInputStream.new(bais)
272
+
273
+ result = ""
274
+ buf = Java::byte[5].new
275
+ rlen = -1
276
+
277
+ while (rlen = iis.read(buf)) != -1 do
278
+ result += java.lang.String.new(java.util.Arrays.copyOf(buf, rlen), "UTF-8")
279
+ end
280
+
281
+ # split into multiple events
282
+ lines = result.split(BATCHED_RECORD_SEPARATOR)
268
283
  lines.each do |line|
269
- event = LogStash::Event.new(line)
284
+ event = LogStash::Event.new("message" => line)
270
285
  event.set("host", event.get("host") || @host)
271
286
  event.set("[@metadata][pubsub_message]", extract_metadata(message)) if @include_metadata
272
287
  decorate(event)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-google_pubsub_compressed_batches'
3
- s.version = '1.2.5'
3
+ s.version = '1.2.6'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = "Consume events from a Google Cloud PubSub service. Supports zlib compressed batches"
6
6
  s.description = "This gem is a Logstash input plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-google_pubsub_compressed_batches
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Johnson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-01-11 00:00:00.000000000 Z
12
+ date: 2021-01-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement