fluent-plugin-split 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -4
- data/README.md +1 -0
- data/fluent-plugin-split.gemspec +3 -2
- data/lib/fluent/plugin/out_split.rb +12 -7
- data/spec/out_split_spec.rb +21 -1
- metadata +18 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33fbe025251d0284353c09b9f6ad80e58064859d
|
4
|
+
data.tar.gz: '08d7309104f1530b76b50d7467ca3a950fabecee'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0a2b5139f887c1092706abc8594ac85cecc7427b632d284fbce12d7847a528ccb082437f22758814c7eb30b0bac81b2f1cae5ee45b27f8ce8799331f91e7ba4
|
7
|
+
data.tar.gz: 8bed2fccc9a6485a1b9a4624ddf5558efe87c0e0c968c6d06eb752f35e0c62e2abc6f0d1f9cd160c9d63c6fe1a79b12c7a36943298ad73242ce3c274f5187cac
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
[![Build Status](https://secure.travis-ci.org/toyama0919/fluent-plugin-split.png?branch=master)](http://travis-ci.org/toyama0919/fluent-plugin-split)
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/fluent-plugin-split.svg)](http://badge.fury.io/rb/fluent-plugin-split)
|
2
3
|
|
3
4
|
# fluent-plugin-split
|
4
5
|
|
data/fluent-plugin-split.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.name = "fluent-plugin-split"
|
6
|
-
gem.version = "0.0
|
6
|
+
gem.version = "0.1.0"
|
7
7
|
gem.authors = ["Hiroshi Toyama"]
|
8
8
|
gem.email = "toyama0919@gmail.com"
|
9
9
|
gem.homepage = "https://github.com/toyama0919/fluent-plugin-split"
|
@@ -17,11 +17,12 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
18
|
gem.require_paths = ['lib']
|
19
19
|
|
20
|
-
gem.
|
20
|
+
gem.add_runtime_dependency "fluentd"
|
21
21
|
gem.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
gem.add_development_dependency "rake"
|
23
23
|
gem.add_development_dependency "rspec"
|
24
24
|
gem.add_development_dependency "spork"
|
25
25
|
gem.add_development_dependency "pry"
|
26
|
+
gem.add_development_dependency "test-unit", "~> 3.2"
|
26
27
|
|
27
28
|
end
|
@@ -3,15 +3,19 @@ module Fluent
|
|
3
3
|
class SplitOutput < Output
|
4
4
|
Fluent::Plugin.register_output('split', self)
|
5
5
|
|
6
|
-
def initialize
|
7
|
-
super
|
8
|
-
end
|
9
|
-
|
10
6
|
# Define `router` method of v0.12 to support v0.10 or earlier
|
11
7
|
unless method_defined?(:router)
|
12
8
|
define_method("router") { Fluent::Engine }
|
13
9
|
end
|
14
10
|
|
11
|
+
unless method_defined?(:log)
|
12
|
+
define_method(:log) { $log }
|
13
|
+
end
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
15
19
|
config_param :output_tag, :string
|
16
20
|
config_param :output_key, :string
|
17
21
|
config_param :format, :string, default: 'csv'
|
@@ -43,10 +47,11 @@ module Fluent
|
|
43
47
|
router.emit(output_tag, time, result)
|
44
48
|
end
|
45
49
|
end
|
46
|
-
chain.next
|
47
50
|
rescue => e
|
48
|
-
|
49
|
-
|
51
|
+
log.warn e.message
|
52
|
+
log.warn e.backtrace.join(', ')
|
53
|
+
ensure
|
54
|
+
chain.next
|
50
55
|
end
|
51
56
|
end
|
52
57
|
end
|
data/spec/out_split_spec.rb
CHANGED
@@ -7,7 +7,7 @@ class SplitOutputTest < Test::Unit::TestCase
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def create_driver(conf = CONFIG, tag = 'test')
|
10
|
-
d = Fluent::Test::
|
10
|
+
d = Fluent::Test::OutputTestDriver.new(Fluent::SplitOutput, tag).configure(conf)
|
11
11
|
d
|
12
12
|
end
|
13
13
|
|
@@ -68,4 +68,24 @@ class SplitOutputTest < Test::Unit::TestCase
|
|
68
68
|
]
|
69
69
|
end
|
70
70
|
end
|
71
|
+
|
72
|
+
def test_emits
|
73
|
+
tag = "split.keyword"
|
74
|
+
d = create_driver %[
|
75
|
+
type split
|
76
|
+
output_tag #{tag}
|
77
|
+
output_key keyword
|
78
|
+
format csv
|
79
|
+
key_name keywords
|
80
|
+
keep_keys site
|
81
|
+
], "test.split"
|
82
|
+
|
83
|
+
time = Time.now.to_i
|
84
|
+
d.run {
|
85
|
+
d.emit({"keywords"=>"keyword1,keyword2,keyword3", "site" => "google", "user_id" => "1"}, time)
|
86
|
+
}
|
87
|
+
assert_equal [[tag, time, {"keyword"=>"keyword1", "site"=>"google"}],
|
88
|
+
[tag, time, {"keyword"=>"keyword2", "site"=>"google"}],
|
89
|
+
[tag, time, {"keyword"=>"keyword3", "site"=>"google"}]], d.emits
|
90
|
+
end
|
71
91
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-split
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi Toyama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -17,7 +17,7 @@ dependencies:
|
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
|
-
type: :
|
20
|
+
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: test-unit
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.2'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.2'
|
97
111
|
description: Output Split String Plugin for fluentd
|
98
112
|
email: toyama0919@gmail.com
|
99
113
|
executables: []
|
@@ -132,11 +146,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
146
|
version: '0'
|
133
147
|
requirements: []
|
134
148
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.
|
149
|
+
rubygems_version: 2.6.11
|
136
150
|
signing_key:
|
137
151
|
specification_version: 4
|
138
152
|
summary: Output Split String Plugin for fluentd
|
139
153
|
test_files:
|
140
154
|
- spec/out_split_spec.rb
|
141
155
|
- spec/spec_helper.rb
|
142
|
-
has_rdoc: false
|