adp-fluentd-plugin-gzip 0.0.4 → 0.0.5
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 -17
- 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: d64b401c92b4a5c10a6a08ec7f6bbe1eb0e905dec4c1a165241facf3a7cab4ad
|
4
|
+
data.tar.gz: '087fce736af304a20efd923ac0f2af9e9237d66e3f01a17a31a8e92e8f7c67c3'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 016b14226653374078bb5188b0385e8736af11c500c1d54400f30ab84c68acf7165bbc373f918b1ed3363f800798a85477cb66c074bf154963e1fc80c78eba6c
|
7
|
+
data.tar.gz: ec6ab9697ea8170e05aab9382adc1bef5850cfe35fe93abae33ab05a429794c229048e6c6e826d20bf05c0363b4a0312322eac033e4d48ade20e58f5803f1522
|
@@ -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.5"
|
6
6
|
spec.authors = ["Aleksander Dudek"]
|
7
7
|
spec.email = ["aleksander.dudek@ringieraxelspringer.pl"]
|
8
8
|
|
@@ -5,26 +5,28 @@ require 'logger'
|
|
5
5
|
logger = Logger.new(STDOUT)
|
6
6
|
logger.level = Logger::INFO
|
7
7
|
|
8
|
-
module Fluent
|
9
|
-
|
10
|
-
|
8
|
+
module Fluent
|
9
|
+
module Plugin
|
10
|
+
class GzipParser < Parser
|
11
|
+
Plugin.register_parser('gzip', self)
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
def configure(conf)
|
14
|
+
super
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
def parse(text)
|
18
|
+
logger.info("Text: #{text}")
|
19
|
+
logger.info("After compression: #{compress(text)}")
|
20
|
+
text
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
def compress(string, level = Zlib::DEFAULT_COMPRESSION, strategy = Zlib::DEFAULT_STRATEGY)
|
24
|
+
output = Stream.new
|
25
|
+
gz = Zlib::GzipWriter.new(output, level, strategy)
|
26
|
+
gz.write(string)
|
27
|
+
gz.close
|
28
|
+
output.string
|
29
|
+
end
|
28
30
|
end
|
29
31
|
end
|
30
32
|
end
|