fluent-plugin-dockergelf 0.1.0 → 0.1.1
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/Gemfile +2 -0
- data/Gemfile.lock +50 -0
- data/README.md +42 -0
- data/Rakefile +13 -0
- data/fluent-plugin-dockergelf.gemspec +27 -0
- data/lib/fluent/plugin/filter_dockergelf.rb +18 -0
- data/pkg/fluent-plugin-dockergelf-0.1.1.gem +0 -0
- data/test/helper.rb +8 -0
- data/test/plugin/test_filter_dockergelf.rb +74 -0
- metadata +14 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f31e69a40fc958849690d673287249215fd55bf8d393fc66ea7c867eee2e8d3
|
4
|
+
data.tar.gz: 0f7188925e292464ac4d9b6ef56a196fed216d204a6aea97083f252ca46fa42f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f02dd1b936437a0c8b9852fe03ed301fcb82944750fcd44af12798cef8595eb4e5fd2c7acd01cfdf6cb0fcc61d63f88a9d288e81dcc1d09dc9dccac86f5c423d
|
7
|
+
data.tar.gz: 4b4ce7ce13fe216e5c846f7c762f5e568fef63f7d9e1a2757ce498082ea968e8becc90717dc77dee01ba68a8736ddbbf4e046c064f5e0a7e03f1d8670cf79e1b
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
fluent-plugin-dockergelf (0.1.1)
|
5
|
+
fluentd (>= 0.14.10, < 2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
cool.io (1.5.3)
|
11
|
+
dig_rb (1.0.1)
|
12
|
+
fluentd (1.2.6)
|
13
|
+
cool.io (>= 1.4.5, < 2.0.0)
|
14
|
+
dig_rb (~> 1.0.0)
|
15
|
+
http_parser.rb (>= 0.5.1, < 0.7.0)
|
16
|
+
msgpack (>= 0.7.0, < 2.0.0)
|
17
|
+
serverengine (>= 2.0.4, < 3.0.0)
|
18
|
+
sigdump (~> 0.2.2)
|
19
|
+
strptime (>= 0.2.2, < 1.0.0)
|
20
|
+
tzinfo (~> 1.0)
|
21
|
+
tzinfo-data (~> 1.0)
|
22
|
+
yajl-ruby (~> 1.0)
|
23
|
+
http_parser.rb (0.6.0)
|
24
|
+
msgpack (1.2.4)
|
25
|
+
power_assert (1.1.3)
|
26
|
+
rake (12.3.1)
|
27
|
+
serverengine (2.0.7)
|
28
|
+
sigdump (~> 0.2.2)
|
29
|
+
sigdump (0.2.4)
|
30
|
+
strptime (0.2.3)
|
31
|
+
test-unit (3.2.8)
|
32
|
+
power_assert
|
33
|
+
thread_safe (0.3.6)
|
34
|
+
tzinfo (1.2.5)
|
35
|
+
thread_safe (~> 0.1)
|
36
|
+
tzinfo-data (1.2018.7)
|
37
|
+
tzinfo (>= 1.0.0)
|
38
|
+
yajl-ruby (1.4.1)
|
39
|
+
|
40
|
+
PLATFORMS
|
41
|
+
ruby
|
42
|
+
|
43
|
+
DEPENDENCIES
|
44
|
+
bundler (~> 1.14)
|
45
|
+
fluent-plugin-dockergelf!
|
46
|
+
rake (~> 12.0)
|
47
|
+
test-unit (~> 3.0)
|
48
|
+
|
49
|
+
BUNDLED WITH
|
50
|
+
1.17.1
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# fluent-plugin-dockergelf
|
2
|
+
|
3
|
+
[Fluentd](https://fluentd.org/) filter plugin to do something.
|
4
|
+
|
5
|
+
TODO: write description for you plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
### RubyGems
|
10
|
+
|
11
|
+
```
|
12
|
+
$ gem install fluent-plugin-dockergelf
|
13
|
+
```
|
14
|
+
|
15
|
+
### Bundler
|
16
|
+
|
17
|
+
Add following line to your Gemfile:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem "fluent-plugin-dockergelf"
|
21
|
+
```
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
```
|
26
|
+
$ bundle
|
27
|
+
```
|
28
|
+
|
29
|
+
## Configuration
|
30
|
+
|
31
|
+
You can generate configuration template:
|
32
|
+
|
33
|
+
```
|
34
|
+
$ fluent-plugin-config-format filter dockergelf
|
35
|
+
```
|
36
|
+
|
37
|
+
You can copy and paste generated documents here.
|
38
|
+
|
39
|
+
## Copyright
|
40
|
+
|
41
|
+
* Copyright(c) 2018- Ericsson AB
|
42
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "bundler"
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require "rake/testtask"
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs.push("lib", "test")
|
8
|
+
t.test_files = FileList["test/**/test_*.rb"]
|
9
|
+
t.verbose = true
|
10
|
+
t.warning = true
|
11
|
+
end
|
12
|
+
|
13
|
+
task default: [:test]
|
@@ -0,0 +1,27 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "fluent-plugin-dockergelf"
|
6
|
+
spec.version = "0.1.1"
|
7
|
+
spec.authors = ["Bo Zhang"]
|
8
|
+
spec.email = ["bo.zhang@inoviagroup.se"]
|
9
|
+
|
10
|
+
spec.summary = %q{rrr}
|
11
|
+
spec.description = %q{ttt}
|
12
|
+
spec.homepage = "http://google.com"
|
13
|
+
spec.license = ""
|
14
|
+
|
15
|
+
test_files, files = `git ls-files -z`.split("\x0").partition do |f|
|
16
|
+
f.match(%r{^(test|spec|features)/})
|
17
|
+
end
|
18
|
+
spec.files = files
|
19
|
+
spec.executables = files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.test_files = test_files
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
24
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
25
|
+
spec.add_development_dependency "test-unit", "~> 3.0"
|
26
|
+
spec.add_runtime_dependency "fluentd", [">= 0.14.10", "< 2"]
|
27
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "fluent/plugin/filter"
|
2
|
+
|
3
|
+
module Fluent
|
4
|
+
module Plugin
|
5
|
+
class DockergelfFilter < Fluent::Plugin::Filter
|
6
|
+
Fluent::Plugin.register_filter("dockergelf", self)
|
7
|
+
def configure(conf)
|
8
|
+
super
|
9
|
+
end
|
10
|
+
def filter(tag, time, record)
|
11
|
+
puts tag
|
12
|
+
puts time
|
13
|
+
puts record
|
14
|
+
record
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
Binary file
|
data/test/helper.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.expand_path("../../", __FILE__))
|
2
|
+
require "test-unit"
|
3
|
+
require "fluent/test"
|
4
|
+
require "fluent/test/driver/filter"
|
5
|
+
require "fluent/test/helpers"
|
6
|
+
|
7
|
+
Test::Unit::TestCase.include(Fluent::Test::Helpers)
|
8
|
+
Test::Unit::TestCase.extend(Fluent::Test::Helpers)
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require "helper"
|
2
|
+
require "fluent/plugin/filter_dockergelf.rb"
|
3
|
+
|
4
|
+
class DockergelfFilterTest < Test::Unit::TestCase
|
5
|
+
setup do
|
6
|
+
Fluent::Test.setup
|
7
|
+
end
|
8
|
+
|
9
|
+
# default configuration for tests
|
10
|
+
CONFIG = %[
|
11
|
+
param1 value1
|
12
|
+
param2 value2
|
13
|
+
]
|
14
|
+
|
15
|
+
def create_driver(conf = CONFIG)
|
16
|
+
Fluent::Test::Driver::Filter.new(Fluent::Plugin::DockergelfFilter).configure(conf)
|
17
|
+
end
|
18
|
+
|
19
|
+
def filter(config, messages)
|
20
|
+
d = create_driver(config)
|
21
|
+
d.run(default_tag: "input.access") do
|
22
|
+
messages.each do |message|
|
23
|
+
d.feed(message)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
d.filtered_records
|
27
|
+
end
|
28
|
+
|
29
|
+
# sub_test_case 'configured with invalid configuration' do
|
30
|
+
# test 'empty configuration' do
|
31
|
+
# assert_raise(Fluent::ConfigError) do
|
32
|
+
# create_driver('')
|
33
|
+
# end
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
# test 'param1 should reject too short string' do
|
37
|
+
# conf = %[
|
38
|
+
# param1 a
|
39
|
+
# ]
|
40
|
+
# assert_raise(Fluent::ConfigError) do
|
41
|
+
# create_driver(conf)
|
42
|
+
# end
|
43
|
+
# end
|
44
|
+
# # ...
|
45
|
+
# end
|
46
|
+
|
47
|
+
sub_test_case 'plugin will add some fields' do
|
48
|
+
test 'add hostname to record' do
|
49
|
+
conf = CONFIG
|
50
|
+
messages = [
|
51
|
+
{"message" => "This is test message"}
|
52
|
+
]
|
53
|
+
expected = [
|
54
|
+
{"message" => "This is test message"}
|
55
|
+
]
|
56
|
+
filtered_records = filter(conf, messages)
|
57
|
+
assert_equal(expected, filtered_records)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
sub_test_case 'plugin will add some fields' do
|
62
|
+
test 'add hostname to record' do
|
63
|
+
conf = CONFIG
|
64
|
+
messages = [
|
65
|
+
{ "message" => "This is test message" }
|
66
|
+
]
|
67
|
+
expected = [
|
68
|
+
{ "message" => "This is test message"}
|
69
|
+
]
|
70
|
+
filtered_records = filter(conf, messages)
|
71
|
+
assert_equal(expected, filtered_records)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-dockergelf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bo Zhang
|
@@ -78,7 +78,16 @@ email:
|
|
78
78
|
executables: []
|
79
79
|
extensions: []
|
80
80
|
extra_rdoc_files: []
|
81
|
-
files:
|
81
|
+
files:
|
82
|
+
- Gemfile
|
83
|
+
- Gemfile.lock
|
84
|
+
- README.md
|
85
|
+
- Rakefile
|
86
|
+
- fluent-plugin-dockergelf.gemspec
|
87
|
+
- lib/fluent/plugin/filter_dockergelf.rb
|
88
|
+
- pkg/fluent-plugin-dockergelf-0.1.1.gem
|
89
|
+
- test/helper.rb
|
90
|
+
- test/plugin/test_filter_dockergelf.rb
|
82
91
|
homepage: http://google.com
|
83
92
|
licenses:
|
84
93
|
- ''
|
@@ -103,4 +112,6 @@ rubygems_version: 2.7.7
|
|
103
112
|
signing_key:
|
104
113
|
specification_version: 4
|
105
114
|
summary: rrr
|
106
|
-
test_files:
|
115
|
+
test_files:
|
116
|
+
- test/helper.rb
|
117
|
+
- test/plugin/test_filter_dockergelf.rb
|