adp-fluentd-plugin-gzip 0.0.2 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/adp-fluentd-plugin-gzip.gemspec +1 -1
- data/lib/fluent/plugin/parser_gzip.rb +19 -16
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5972aada761fe9fdf6104fbe0b961e44fff65e507cf6be08b6cfa9ba9857e296
|
4
|
+
data.tar.gz: f2a0c1020eeb7926e6f39dcb4f4c99547084f427835647c4e46c1347aad53b9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f261798083024d9e3777e108aef24a2d181673954823226f8be8acd9c45f0cb4aa9135b0a0c8327e823ca426bbfab38532c007b71c8a57d93e4afb6ecf7efa49
|
7
|
+
data.tar.gz: 3ff89156b9b14a5ed67d78f70b736c43663347feaf373ef637dd463b554b35c1bcdd54eab71f81e90c54fe919c93025fd7ddcf9f59612b354fe1bf22f915000b
|
@@ -2,7 +2,7 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "adp-fluentd-plugin-gzip"
|
5
|
-
spec.version = "0.0.
|
5
|
+
spec.version = "0.0.6"
|
6
6
|
spec.authors = ["Aleksander Dudek"]
|
7
7
|
spec.email = ["aleksander.dudek@ringieraxelspringer.pl"]
|
8
8
|
|
@@ -1,25 +1,28 @@
|
|
1
1
|
require 'fluent/plugin/parser'
|
2
2
|
require 'zlib'
|
3
3
|
|
4
|
-
module Fluent
|
5
|
-
|
6
|
-
|
4
|
+
module Fluent
|
5
|
+
module Plugin
|
6
|
+
class GzipParser < Parser
|
7
|
+
Plugin.register_parser('gzip', self)
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
def configure(conf)
|
10
|
+
super
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
def parse(text)
|
14
|
+
log.info("Text: #{text}")
|
15
|
+
log.info("After compression: #{compress(text)}")
|
16
|
+
text
|
17
|
+
end
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
def compress(string, level = Zlib::DEFAULT_COMPRESSION, strategy = Zlib::DEFAULT_STRATEGY)
|
20
|
+
output = Stream.new
|
21
|
+
gz = Zlib::GzipWriter.new(output, level, strategy)
|
22
|
+
gz.write(string)
|
23
|
+
gz.close
|
24
|
+
output.string
|
25
|
+
end
|
23
26
|
end
|
24
27
|
end
|
25
28
|
end
|