fluent-plugin-convert-value-to-sha 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/.travis.yml +4 -0
- data/fluent-plugin-convert-value-to-sha.gemspec +1 -1
- data/lib/fluent/plugin/out_convert_to_sha.rb +6 -1
- data/test/test_out_convert_to_sha.rb +12 -9
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5b0f2e2336d59dcbea622bab216100fa06f5eb3
|
4
|
+
data.tar.gz: 4dd053cfa6367da0513d9a211ed5de2399486aff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0e97fb0ad3f39562aa2c44257842997e3a1c0f9c62c2b11f91616150677ae8843e68498f407bd22f59e1b2858dfbc8b1c4a9d0de860a160387d6fa413b0f7b7
|
7
|
+
data.tar.gz: 2a14d6a8e66fb21663af37f92c9781f6f6a2185728134d8e967816cc8a0a560062689cbd54b0d8991d7d4f588e0412ed4e10da9163cb02ffa873ce4624e5bc7f
|
data/.travis.yml
ADDED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fluent-plugin-convert-value-to-sha"
|
7
|
-
spec.version = "0.1.
|
7
|
+
spec.version = "0.1.1"
|
8
8
|
spec.authors = ["Keiji Matsuzaki"]
|
9
9
|
spec.email = ["futoase@gmail.com"]
|
10
10
|
spec.description = %q{This plugin is convert value to sha.}
|
@@ -15,6 +15,7 @@ class Fluent::ConvertToSha < Fluent::Output
|
|
15
15
|
config_param :sha, :string, :default => '256'
|
16
16
|
config_param :salt, :string, :default => 'mako'
|
17
17
|
config_param :key, :string, :default => nil
|
18
|
+
config_param :tag, :string, :default => 'sha'
|
18
19
|
|
19
20
|
def configure(conf)
|
20
21
|
super
|
@@ -31,6 +32,10 @@ class Fluent::ConvertToSha < Fluent::Output
|
|
31
32
|
raise Fluent::ConfigError, "require key name."
|
32
33
|
end
|
33
34
|
|
35
|
+
if @tag.to_s.length == 0
|
36
|
+
raise Fluent::ConfigError, "require tag name."
|
37
|
+
end
|
38
|
+
|
34
39
|
@mutex = Mutex.new
|
35
40
|
|
36
41
|
end
|
@@ -45,7 +50,7 @@ class Fluent::ConvertToSha < Fluent::Output
|
|
45
50
|
|
46
51
|
def emit(tag, es, chain)
|
47
52
|
es.each do |time, record|
|
48
|
-
Fluent::Engine.emit(tag, time, convert_to_sha(record))
|
53
|
+
Fluent::Engine.emit(@tag, time, convert_to_sha(record))
|
49
54
|
end
|
50
55
|
|
51
56
|
chain.next
|
@@ -10,18 +10,21 @@ class ConvertToShaTest < Test::Unit::TestCase
|
|
10
10
|
sha 256
|
11
11
|
salt hoge
|
12
12
|
key uid
|
13
|
+
tag moimoi
|
13
14
|
]
|
14
15
|
|
15
16
|
CONFIG_384 = %[
|
16
17
|
sha 384
|
17
18
|
salt hoge
|
18
19
|
key uid
|
20
|
+
tag yatta
|
19
21
|
]
|
20
22
|
|
21
23
|
CONFIG_512 = %[
|
22
24
|
sha 512
|
23
25
|
salt hoge
|
24
26
|
key uid
|
27
|
+
tag omatsuri
|
25
28
|
]
|
26
29
|
|
27
30
|
def create_driver(conf = CONFIG, tag = 'test')
|
@@ -41,17 +44,17 @@ class ConvertToShaTest < Test::Unit::TestCase
|
|
41
44
|
|
42
45
|
# uid is 10000
|
43
46
|
p emits[0]
|
44
|
-
assert_equal "
|
47
|
+
assert_equal "moimoi", emits[0][0]
|
45
48
|
assert_equal Digest::SHA256.hexdigest("hoge10000"), emits[0][2]["uid"]
|
46
49
|
|
47
50
|
# uid is 12345
|
48
51
|
p emits[1]
|
49
|
-
assert_equal "
|
52
|
+
assert_equal "moimoi", emits[1][0]
|
50
53
|
assert_equal Digest::SHA256.hexdigest("hoge12345"), emits[1][2]["uid"]
|
51
54
|
|
52
55
|
# uid is 33333
|
53
56
|
p emits[2]
|
54
|
-
assert_equal "
|
57
|
+
assert_equal "moimoi", emits[2][0]
|
55
58
|
assert_equal Digest::SHA256.hexdigest("hoge33333"), emits[2][2]["uid"]
|
56
59
|
|
57
60
|
end
|
@@ -69,17 +72,17 @@ class ConvertToShaTest < Test::Unit::TestCase
|
|
69
72
|
|
70
73
|
# uid is 10000
|
71
74
|
p emits[0]
|
72
|
-
assert_equal "
|
75
|
+
assert_equal "yatta", emits[0][0]
|
73
76
|
assert_equal Digest::SHA384.hexdigest("hoge10000"), emits[0][2]["uid"]
|
74
77
|
|
75
78
|
# uid is 12345
|
76
79
|
p emits[1]
|
77
|
-
assert_equal "
|
80
|
+
assert_equal "yatta", emits[1][0]
|
78
81
|
assert_equal Digest::SHA384.hexdigest("hoge12345"), emits[1][2]["uid"]
|
79
82
|
|
80
83
|
# uid is 33333
|
81
84
|
p emits[2]
|
82
|
-
assert_equal "
|
85
|
+
assert_equal "yatta", emits[2][0]
|
83
86
|
assert_equal Digest::SHA384.hexdigest("hoge33333"), emits[2][2]["uid"]
|
84
87
|
|
85
88
|
end
|
@@ -97,17 +100,17 @@ class ConvertToShaTest < Test::Unit::TestCase
|
|
97
100
|
|
98
101
|
# uid is 10000
|
99
102
|
p emits[0]
|
100
|
-
assert_equal "
|
103
|
+
assert_equal "omatsuri", emits[0][0]
|
101
104
|
assert_equal Digest::SHA512.hexdigest("hoge10000"), emits[0][2]["uid"]
|
102
105
|
|
103
106
|
# uid is 12345
|
104
107
|
p emits[1]
|
105
|
-
assert_equal "
|
108
|
+
assert_equal "omatsuri", emits[1][0]
|
106
109
|
assert_equal Digest::SHA512.hexdigest("hoge12345"), emits[1][2]["uid"]
|
107
110
|
|
108
111
|
# uid is 33333
|
109
112
|
p emits[2]
|
110
|
-
assert_equal "
|
113
|
+
assert_equal "omatsuri", emits[2][0]
|
111
114
|
assert_equal Digest::SHA512.hexdigest("hoge33333"), emits[2][2]["uid"]
|
112
115
|
|
113
116
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-convert-value-to-sha
|
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
|
- Keiji Matsuzaki
|
@@ -60,6 +60,7 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- .gitignore
|
63
|
+
- .travis.yml
|
63
64
|
- Gemfile
|
64
65
|
- LICENSE.txt
|
65
66
|
- README.md
|