adp-fluentd-plugin-gzip 0.0.5 → 0.0.9
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/adp-fluentd-plugin-gzip.gemspec +1 -1
- data/lib/fluent/plugin/parser_gzip.rb +2 -7
- data/lib/fluent/stream.rb +12 -0
- data/test/adp/fluentd/plugin/gzip_test.rb +31 -7
- data/test/test_helper.rb +3 -4
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: effad8e5c9523b52cecb84e278ea512c886ad5e28a1ab4eed4ef64e9f1ce1fae
|
4
|
+
data.tar.gz: a057973d105fe2f28f46c3829533598a13b90442e0a4f147880933f9249f6e7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44ef566e072274e3c867b6de6434bc34ffcf1eadc05d709bb6838855960a34dbb5a74af49f91d2703a8e70f5c1a1237c10adbda7534f04c911de8b17dcc8507c
|
7
|
+
data.tar.gz: f022c340d53300ba1acc9ac49de7cf0a00b062f65e07855e8aa23e558d4b47c4595aa0d672cd3800ad73810cc0635700132b9fae4ad4360f08b1b882c2638ae8
|
@@ -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.9"
|
6
6
|
spec.authors = ["Aleksander Dudek"]
|
7
7
|
spec.email = ["aleksander.dudek@ringieraxelspringer.pl"]
|
8
8
|
|
@@ -1,9 +1,6 @@
|
|
1
1
|
require 'fluent/plugin/parser'
|
2
2
|
require 'zlib'
|
3
|
-
require '
|
4
|
-
|
5
|
-
logger = Logger.new(STDOUT)
|
6
|
-
logger.level = Logger::INFO
|
3
|
+
require 'fluent/stream'
|
7
4
|
|
8
5
|
module Fluent
|
9
6
|
module Plugin
|
@@ -15,9 +12,7 @@ module Fluent
|
|
15
12
|
end
|
16
13
|
|
17
14
|
def parse(text)
|
18
|
-
|
19
|
-
logger.info("After compression: #{compress(text)}")
|
20
|
-
text
|
15
|
+
compress(text)
|
21
16
|
end
|
22
17
|
|
23
18
|
def compress(string, level = Zlib::DEFAULT_COMPRESSION, strategy = Zlib::DEFAULT_STRATEGY)
|
@@ -1,11 +1,35 @@
|
|
1
|
-
require
|
1
|
+
require 'test/unit'
|
2
|
+
require 'fluent/test/driver/parser'
|
3
|
+
require 'fluent/plugin/parser_gzip'
|
2
4
|
|
3
|
-
class
|
4
|
-
def
|
5
|
-
refute_nil ::Adp::Fluentd::Plugin::Gzip::VERSION
|
5
|
+
class ParserYourOwnTest < Test::Unit::TestCase
|
6
|
+
def setup
|
6
7
|
end
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
CONFIG = %[
|
9
|
+
pattern apache
|
10
|
+
]
|
11
|
+
def create_driver(conf = CONF)
|
12
|
+
Fluent::Test::Driver::Parser.new(Fluent::Plugin::GzipParser).configure(conf)
|
13
|
+
end
|
14
|
+
sub_test_case 'configured with invalid configurations' do
|
15
|
+
test 'empty' do
|
16
|
+
assert_raise(Fluent::ConfigError) do
|
17
|
+
create_driver('')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
sub_test_case 'plugin will parse text' do
|
22
|
+
test 'record has a field' do
|
23
|
+
d = create_driver(CONFIG)
|
24
|
+
text = '192.168.0.1 - - [28/Feb/2013:12:00:00 +0900] "GET / HTTP/1.1" 200 777'
|
25
|
+
expected_time = event_time('28/Feb/2013:12:00:00 +0900', format: '%d/%b/%Y:%H:%M:%S %z')
|
26
|
+
expected_record = {
|
27
|
+
'method' => 'GET',
|
28
|
+
}
|
29
|
+
d.instance.parse(text) do |time, record|
|
30
|
+
assert_equal(expected_time, time)
|
31
|
+
assert_equal(expected_record, record)
|
32
|
+
end
|
33
|
+
end
|
10
34
|
end
|
11
35
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
|
-
require
|
3
|
-
|
4
|
-
require "minitest/autorun"
|
1
|
+
require 'test/unit'
|
2
|
+
require 'fluent/test'
|
3
|
+
require "fluent/plugin/parser_gzip"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adp-fluentd-plugin-gzip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aleksander Dudek
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- bin/console
|
87
87
|
- bin/setup
|
88
88
|
- lib/fluent/plugin/parser_gzip.rb
|
89
|
+
- lib/fluent/stream.rb
|
89
90
|
- test/adp/fluentd/plugin/gzip_test.rb
|
90
91
|
- test/test_helper.rb
|
91
92
|
homepage: https://example.com
|