logstash-codec-gzip_lines 3.0.3 → 3.0.4
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/CHANGELOG.md +3 -0
- data/LICENSE +1 -1
- data/lib/logstash/codecs/gzip_lines.rb +3 -0
- data/logstash-codec-gzip_lines.gemspec +1 -1
- data/spec/codecs/gzip_lines_spec.rb +29 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a8d6e1df05470e50b267a05a2c84af5b87a233604d459e9eeadd1812951fcaa
|
4
|
+
data.tar.gz: 36716ee63274ba9a68ff940ac9636a0fc67b1c2996007d2fb1cce4e33c1d92e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 543609bdb2fc35724003150cf79223a42051857e8ffd74be421b57df04c1dc5532448faa06b9e58c6b79dec7066cc8babe80928771696a192ddc57045907fcd9
|
7
|
+
data.tar.gz: 396c1d8e258291c621cff2af6c9f4f5d584ed1acf5531571aeebc48c070c2d81e8837e786abfd6df0dee2973bf448229e34f100b6b0afcde1163a461f8c0d7a7
|
data/CHANGELOG.md
CHANGED
data/LICENSE
CHANGED
@@ -3,6 +3,7 @@ require "logstash/codecs/base"
|
|
3
3
|
require "logstash/codecs/plain"
|
4
4
|
require "logstash/json"
|
5
5
|
require "zlib"
|
6
|
+
require "stringio"
|
6
7
|
|
7
8
|
# This codec will read gzip encoded content
|
8
9
|
class LogStash::Codecs::GzipLines < LogStash::Codecs::Base
|
@@ -29,6 +30,8 @@ class LogStash::Codecs::GzipLines < LogStash::Codecs::Base
|
|
29
30
|
|
30
31
|
public
|
31
32
|
def decode(data)
|
33
|
+
data = StringIO.new(data) if data.kind_of?(String)
|
34
|
+
|
32
35
|
@decoder = Zlib::GzipReader.new(data)
|
33
36
|
|
34
37
|
begin
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-codec-gzip_lines'
|
4
|
-
s.version = '3.0.
|
4
|
+
s.version = '3.0.4'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Reads `gzip` encoded content"
|
7
7
|
s.description = "This gem is a Logstash 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"
|
@@ -26,18 +26,42 @@ describe LogStash::Codecs::GzipLines do
|
|
26
26
|
str << "2010-03-12 23:51:21 SEA4 192.0.2.222 play 3914 OK bfd8a98bee0840d9b871b7f6ade9908f rtmp://shqshne4jdp4b6.cloudfront.net/cfx/st key=value http://player.longtailvideo.com/player.swf http://www.longtailvideo.com/support/jw-player-setup-wizard?example=204 LNX%2010,0,32,18 myvideo p=2&q=4 flv 1\n"
|
27
27
|
|
28
28
|
str.rewind
|
29
|
+
|
29
30
|
str
|
30
31
|
end
|
31
32
|
|
32
33
|
describe "#decode" do
|
33
|
-
|
34
|
-
|
34
|
+
let(:compressed_log) { compress_with_gzip(uncompressed_log) }
|
35
|
+
|
36
|
+
# Legacy tests and implementation _required_ an `IO`-like object to be
|
37
|
+
# provided to `LogStash::Codecs::GzipLines#decode`, despite the Logstash
|
38
|
+
# API specifying that a `String` is provided. Continue supporting this
|
39
|
+
# to avoid breaking implementations that provide an IO.
|
40
|
+
context 'when given a StringIO' do
|
41
|
+
it "creates one event per line" do
|
42
|
+
events = []
|
43
|
+
|
44
|
+
subject.decode(compressed_log) do |event|
|
45
|
+
events << event
|
46
|
+
end
|
35
47
|
|
36
|
-
|
37
|
-
events << event
|
48
|
+
expect(events.size).to eq(2)
|
38
49
|
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context 'when given a String' do
|
39
53
|
|
40
|
-
|
54
|
+
let(:compressed_log) { super().string }
|
55
|
+
|
56
|
+
it "creates one event per line" do
|
57
|
+
events = []
|
58
|
+
|
59
|
+
subject.decode(compressed_log) do |event|
|
60
|
+
events << event
|
61
|
+
end
|
62
|
+
|
63
|
+
expect(events.size).to eq(2)
|
64
|
+
end
|
41
65
|
end
|
42
66
|
end
|
43
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-codec-gzip_lines
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
100
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.6.
|
101
|
+
rubygems_version: 2.6.13
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: Reads `gzip` encoded content
|