fluent-plugin-string-scrub 0.0.3 → 1.0.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 +5 -5
- data/.travis.yml +16 -3
- data/Gemfile +0 -1
- data/README.md +25 -5
- data/fluent-plugin-string-scrub.gemspec +3 -3
- data/lib/fluent/plugin/filter_string_scrub.rb +63 -0
- data/lib/fluent/plugin/out_string_scrub.rb +29 -19
- data/test/helper.rb +4 -10
- data/test/plugin/test_filter_string-scrub.rb +59 -0
- data/test/plugin/test_out_string-scrub.rb +73 -32
- metadata +18 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3ec5362da8587dc2196f07f27308802fc95533ebea82e77fdca905744a907594
|
4
|
+
data.tar.gz: fad0bd42b3aeb35fcf2a980efd0de44db63d6b2886fad7569891e6d4c8773b85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d6cefbd65bfa5770618d9d0182aa8de32a2b066911b04b394d7b08f5553282426ffa4d77d04fa2db52c65ae43dcea3c6807698ca381d5e59b0b749d2ddcac7a
|
7
|
+
data.tar.gz: e3f0c80c0af477a33751e1375b576281ad051aef7f9a88cad893e3de9334e28b375cefe3e4b1a6cecfd963859ae1fc25b88708b8dcafcd1c7b65546c21fb96b2
|
data/.travis.yml
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
language: ruby
|
2
|
+
script: bundle exec rake
|
3
|
+
sudo: false
|
2
4
|
rvm:
|
3
|
-
- 1
|
4
|
-
- 2.
|
5
|
-
- 2.
|
5
|
+
- 2.1
|
6
|
+
- 2.2
|
7
|
+
- 2.3
|
8
|
+
- 2.4
|
9
|
+
- 2.5
|
10
|
+
- 2.6
|
11
|
+
- 2.7
|
12
|
+
- 3.0
|
13
|
+
|
14
|
+
#- ruby-head
|
15
|
+
gemfile:
|
16
|
+
- Gemfile
|
17
|
+
before_install:
|
18
|
+
- gem update bundler
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -27,7 +27,7 @@ Or install it yourself as:
|
|
27
27
|
|
28
28
|
```
|
29
29
|
<match **>
|
30
|
-
type string_scrub
|
30
|
+
@type string_scrub
|
31
31
|
tag scrubbed.string
|
32
32
|
replace_char ?
|
33
33
|
</match>
|
@@ -37,23 +37,43 @@ Or install it yourself as:
|
|
37
37
|
|
38
38
|
```
|
39
39
|
<source>
|
40
|
-
type forward
|
40
|
+
@type forward
|
41
41
|
</source>
|
42
42
|
|
43
43
|
<match raw.**>
|
44
|
-
type string_scrub
|
44
|
+
@type string_scrub
|
45
45
|
remove_prefix raw
|
46
46
|
add_prefix scrubbed
|
47
47
|
</match>
|
48
48
|
|
49
49
|
<match scrubbed.**>
|
50
|
-
type stdout
|
50
|
+
@type stdout
|
51
51
|
</match>
|
52
52
|
```
|
53
53
|
|
54
|
+
## Filter plugin
|
55
|
+
|
56
|
+
Fluentd >= v0.12 can use filter plugin.
|
57
|
+
|
58
|
+
```
|
59
|
+
<source>
|
60
|
+
@type forward
|
61
|
+
</source>
|
62
|
+
|
63
|
+
<filter **>
|
64
|
+
@type string_scrub
|
65
|
+
replace_char ?
|
66
|
+
</filter>
|
67
|
+
|
68
|
+
<match **>
|
69
|
+
@type stdout
|
70
|
+
</match>
|
71
|
+
```
|
72
|
+
|
73
|
+
|
54
74
|
## Contributing
|
55
75
|
|
56
|
-
1. Fork it ( https://github.com/
|
76
|
+
1. Fork it ( https://github.com/kataring/fluent-plugin-string-scrub/fork )
|
57
77
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
58
78
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
59
79
|
4. Push to the branch (`git push origin my-new-feature`)
|
@@ -3,7 +3,7 @@ lib = File.expand_path('../lib', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = "fluent-plugin-string-scrub"
|
6
|
-
spec.version = "
|
6
|
+
spec.version = "1.0.1"
|
7
7
|
spec.authors = ["Noriaki Katayama"]
|
8
8
|
spec.email = ["kataring@gmail.com"]
|
9
9
|
spec.summary = %q{Fluentd Output filter plugin.}
|
@@ -15,9 +15,9 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
16
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
17
|
spec.require_paths = ["lib"]
|
18
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.1".freeze)
|
18
19
|
|
19
20
|
spec.add_development_dependency "rake"
|
20
21
|
spec.add_development_dependency "test-unit"
|
21
|
-
spec.add_development_dependency "fluentd"
|
22
|
-
spec.add_runtime_dependency "string-scrub", "~> 0.0.5" if RUBY_VERSION.to_f < 2.1
|
22
|
+
spec.add_development_dependency "fluentd", [">= 0.14.0", "< 2"]
|
23
23
|
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'fluent/plugin/filter'
|
2
|
+
|
3
|
+
class Fluent::Plugin::StringScrubFilter < Fluent::Plugin::Filter
|
4
|
+
Fluent::Plugin.register_filter('string_scrub', self)
|
5
|
+
|
6
|
+
config_param :replace_char, :string, :default => ''
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
super
|
10
|
+
end
|
11
|
+
|
12
|
+
def configure(conf)
|
13
|
+
super
|
14
|
+
|
15
|
+
if @replace_char =~ /\\u\{*[A-F0-9]{4}\}*/
|
16
|
+
@replace_char = eval("\"#{@replace_char}\"")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def filter_stream(tag, es)
|
21
|
+
new_es = Fluent::MultiEventStream.new
|
22
|
+
es.each do |time,record|
|
23
|
+
begin
|
24
|
+
scrubbed = recv_record(record)
|
25
|
+
next if scrubbed.nil?
|
26
|
+
new_es.add(time, scrubbed)
|
27
|
+
rescue => e
|
28
|
+
router.emit_error_event(tag, time, record, e)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
new_es
|
33
|
+
end
|
34
|
+
|
35
|
+
def recv_record(record)
|
36
|
+
scrubbed = {}
|
37
|
+
record.each do |k,v|
|
38
|
+
if v.instance_of? Hash
|
39
|
+
scrubbed[with_scrub(k)] = recv_record(v)
|
40
|
+
elsif v.instance_of? Integer
|
41
|
+
scrubbed[k] = v
|
42
|
+
else
|
43
|
+
scrubbed[with_scrub(k)] = with_scrub(v)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
scrubbed
|
47
|
+
end
|
48
|
+
|
49
|
+
def with_scrub(string)
|
50
|
+
begin
|
51
|
+
string =~ //
|
52
|
+
return string
|
53
|
+
rescue ArgumentError => e
|
54
|
+
raise e unless e.message.index("invalid byte sequence in") == 0
|
55
|
+
if string.frozen?
|
56
|
+
string = string.dup.scrub!(@replace_char)
|
57
|
+
else
|
58
|
+
string.scrub!(@replace_char)
|
59
|
+
end
|
60
|
+
retry
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -1,6 +1,10 @@
|
|
1
|
-
|
1
|
+
require 'fluent/plugin/output'
|
2
|
+
|
3
|
+
class Fluent::Plugin::StringScrubOutput < Fluent::Plugin::Output
|
2
4
|
Fluent::Plugin.register_output('string_scrub', self)
|
3
5
|
|
6
|
+
helpers :event_emitter
|
7
|
+
|
4
8
|
config_param :tag, :string, :default => nil
|
5
9
|
config_param :remove_prefix, :string, :default => nil
|
6
10
|
config_param :add_prefix, :string, :default => nil
|
@@ -8,31 +12,33 @@ class Fluent::StringScrubOutput < Fluent::Output
|
|
8
12
|
|
9
13
|
def initialize
|
10
14
|
super
|
11
|
-
require 'string/scrub' if RUBY_VERSION.to_f < 2.1
|
12
15
|
end
|
13
16
|
|
14
17
|
def configure(conf)
|
15
18
|
super
|
16
19
|
|
17
|
-
if
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
20
|
+
if conf['@label'].nil?
|
21
|
+
if not @tag and not @remove_prefix and not @add_prefix
|
22
|
+
raise Fluent::ConfigError, "missing both of remove_prefix and add_prefix"
|
23
|
+
end
|
24
|
+
if @tag and (@remove_prefix or @add_prefix)
|
25
|
+
raise Fluent::ConfigError, "both of tag and remove_prefix/add_prefix must not be specified"
|
26
|
+
end
|
27
|
+
if @remove_prefix
|
28
|
+
@removed_prefix_string = @remove_prefix + '.'
|
29
|
+
@removed_length = @removed_prefix_string.length
|
30
|
+
end
|
31
|
+
if @add_prefix
|
32
|
+
@added_prefix_string = @add_prefix + '.'
|
33
|
+
end
|
29
34
|
end
|
35
|
+
|
30
36
|
if @replace_char =~ /\\u\{*[A-F0-9]{4}\}*/
|
31
37
|
@replace_char = eval("\"#{@replace_char}\"")
|
32
38
|
end
|
33
39
|
end
|
34
40
|
|
35
|
-
def
|
41
|
+
def process(tag, es)
|
36
42
|
tag = if @tag
|
37
43
|
@tag
|
38
44
|
else
|
@@ -53,10 +59,8 @@ class Fluent::StringScrubOutput < Fluent::Output
|
|
53
59
|
es.each do |time,record|
|
54
60
|
scrubbed = recv_record(record)
|
55
61
|
next if scrubbed.nil?
|
56
|
-
|
62
|
+
router.emit(tag, time, scrubbed)
|
57
63
|
end
|
58
|
-
|
59
|
-
chain.next
|
60
64
|
end
|
61
65
|
|
62
66
|
def recv_record(record)
|
@@ -64,6 +68,8 @@ class Fluent::StringScrubOutput < Fluent::Output
|
|
64
68
|
record.each do |k,v|
|
65
69
|
if v.instance_of? Hash
|
66
70
|
scrubbed[with_scrub(k)] = recv_record(v)
|
71
|
+
elsif v.instance_of? Integer
|
72
|
+
scrubbed[k] = v
|
67
73
|
else
|
68
74
|
scrubbed[with_scrub(k)] = with_scrub(v)
|
69
75
|
end
|
@@ -77,7 +83,11 @@ class Fluent::StringScrubOutput < Fluent::Output
|
|
77
83
|
return string
|
78
84
|
rescue ArgumentError => e
|
79
85
|
raise e unless e.message.index("invalid byte sequence in") == 0
|
80
|
-
string.
|
86
|
+
if string.frozen?
|
87
|
+
string = string.dup.scrub!(@replace_char)
|
88
|
+
else
|
89
|
+
string.scrub!(@replace_char)
|
90
|
+
end
|
81
91
|
retry
|
82
92
|
end
|
83
93
|
end
|
data/test/helper.rb
CHANGED
@@ -12,17 +12,11 @@ require 'test/unit'
|
|
12
12
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
13
13
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
14
14
|
require 'fluent/test'
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
def method_missing(method, *args)
|
19
|
-
# pass
|
20
|
-
end
|
21
|
-
}
|
22
|
-
$log = nulllogger
|
23
|
-
end
|
24
|
-
|
15
|
+
require 'fluent/version'
|
16
|
+
require 'fluent/test/driver/output'
|
17
|
+
require 'fluent/test/driver/filter'
|
25
18
|
require 'fluent/plugin/out_string_scrub'
|
19
|
+
require 'fluent/plugin/filter_string_scrub'
|
26
20
|
|
27
21
|
class Test::Unit::TestCase
|
28
22
|
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class StringScrubFilterTest < Test::Unit::TestCase
|
4
|
+
include Fluent
|
5
|
+
|
6
|
+
def setup
|
7
|
+
Fluent::Test.setup
|
8
|
+
@time = Fluent::Engine.now
|
9
|
+
end
|
10
|
+
|
11
|
+
CONFIG = %[
|
12
|
+
replace_char ?
|
13
|
+
]
|
14
|
+
|
15
|
+
CONFIG_UNICODE_1 = %[
|
16
|
+
replace_char \uFFFD
|
17
|
+
]
|
18
|
+
|
19
|
+
CONFIG_UNICODE_2 = %[
|
20
|
+
replace_char \u{FFFD}
|
21
|
+
]
|
22
|
+
|
23
|
+
def create_driver(conf=CONFIG)
|
24
|
+
Fluent::Test::Driver::Filter.new(Fluent::Plugin::StringScrubFilter).configure(conf)
|
25
|
+
end
|
26
|
+
|
27
|
+
def filter(config, msgs)
|
28
|
+
d = create_driver(config)
|
29
|
+
d.run(default_tag: 'test.filter') {
|
30
|
+
msgs.each {|msg|
|
31
|
+
d.feed(@time, msg)
|
32
|
+
}
|
33
|
+
}
|
34
|
+
filtered = d.filtered
|
35
|
+
filtered.map {|m| m[1] }
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_filter1
|
39
|
+
orig_message = 'testtesttest'
|
40
|
+
invalid_utf8 = "\xff".force_encoding('UTF-8')
|
41
|
+
msg = {"message" => orig_message + invalid_utf8}
|
42
|
+
filtered = filter(CONFIG, [msg])
|
43
|
+
assert_equal([{"message" => orig_message + '?'}], filtered)
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_filter2_frozen_string
|
47
|
+
orig_message = 'testtesttest'
|
48
|
+
invalid_utf8 = "\xff".force_encoding('UTF-8')
|
49
|
+
msg = {"message" => (orig_message + invalid_utf8).freeze}
|
50
|
+
filtered = filter(CONFIG, [msg])
|
51
|
+
assert_equal([{"message" => orig_message + '?'}], filtered)
|
52
|
+
|
53
|
+
def test_filter_integer
|
54
|
+
orig_message = 123456789
|
55
|
+
msg = {"message" => orig_message}
|
56
|
+
filtered = filter(CONFIG, [msg])
|
57
|
+
assert_equal([{"message" => orig_message}], filtered)
|
58
|
+
end
|
59
|
+
end
|
@@ -28,8 +28,8 @@ class StringScrubOutputTest < Test::Unit::TestCase
|
|
28
28
|
replace_char \u{FFFD}
|
29
29
|
]
|
30
30
|
|
31
|
-
def create_driver(conf=CONFIG
|
32
|
-
Fluent::Test::
|
31
|
+
def create_driver(conf = CONFIG)
|
32
|
+
Fluent::Test::Driver::Output.new(Fluent::Plugin::StringScrubOutput).configure(conf)
|
33
33
|
end
|
34
34
|
|
35
35
|
def test_configure
|
@@ -81,25 +81,25 @@ class StringScrubOutputTest < Test::Unit::TestCase
|
|
81
81
|
def test_emit1_invalid_string
|
82
82
|
orig_message = 'testtesttest'
|
83
83
|
invalid_utf8 = "\xff".force_encoding('UTF-8')
|
84
|
-
d1 = create_driver(CONFIG
|
85
|
-
d1.run do
|
86
|
-
d1.
|
84
|
+
d1 = create_driver(CONFIG)
|
85
|
+
d1.run(default_tag: 'input.log') do
|
86
|
+
d1.feed({'message' => orig_message + invalid_utf8})
|
87
87
|
end
|
88
|
-
emits = d1.
|
88
|
+
emits = d1.events
|
89
89
|
assert_equal 1, emits.length
|
90
|
-
|
90
|
+
|
91
91
|
e1 = emits[0]
|
92
92
|
assert_equal "scrubbed.log", e1[0]
|
93
93
|
assert_equal orig_message, e1[2]['message']
|
94
94
|
|
95
95
|
invalid_ascii = "\xff".force_encoding('US-ASCII')
|
96
|
-
d2 = create_driver(CONFIG
|
97
|
-
d2.run do
|
98
|
-
d2.
|
96
|
+
d2 = create_driver(CONFIG)
|
97
|
+
d2.run(default_tag: 'input.log2') do
|
98
|
+
d2.feed({'message' => orig_message + invalid_utf8})
|
99
99
|
end
|
100
|
-
emits = d2.
|
100
|
+
emits = d2.events
|
101
101
|
assert_equal 1, emits.length
|
102
|
-
|
102
|
+
|
103
103
|
e2 = emits[0]
|
104
104
|
assert_equal "scrubbed.log2", e2[0]
|
105
105
|
assert_equal orig_message, e2[2]['message']
|
@@ -108,11 +108,11 @@ class StringScrubOutputTest < Test::Unit::TestCase
|
|
108
108
|
def test_emit2_replace_char
|
109
109
|
orig_message = 'testtesttest'
|
110
110
|
invalid_utf8 = "\xff".force_encoding('UTF-8')
|
111
|
-
d1 = create_driver(CONFIG_REPLACE_CHAR
|
112
|
-
d1.run do
|
113
|
-
d1.
|
111
|
+
d1 = create_driver(CONFIG_REPLACE_CHAR)
|
112
|
+
d1.run(default_tag: 'input.log') do
|
113
|
+
d1.feed({'message' => orig_message + invalid_utf8})
|
114
114
|
end
|
115
|
-
emits = d1.
|
115
|
+
emits = d1.events
|
116
116
|
assert_equal 1, emits.length
|
117
117
|
|
118
118
|
e1 = emits[0]
|
@@ -120,11 +120,11 @@ class StringScrubOutputTest < Test::Unit::TestCase
|
|
120
120
|
assert_equal orig_message + '?', e1[2]['message']
|
121
121
|
|
122
122
|
invalid_ascii = "\xff".force_encoding('US-ASCII')
|
123
|
-
d2 = create_driver(CONFIG_REPLACE_CHAR
|
124
|
-
d2.run do
|
125
|
-
d2.
|
123
|
+
d2 = create_driver(CONFIG_REPLACE_CHAR)
|
124
|
+
d2.run(default_tag: 'input.log2') do
|
125
|
+
d2.feed({'message' => orig_message + invalid_utf8})
|
126
126
|
end
|
127
|
-
emits = d2.
|
127
|
+
emits = d2.events
|
128
128
|
assert_equal 1, emits.length
|
129
129
|
|
130
130
|
e2 = emits[0]
|
@@ -135,11 +135,11 @@ class StringScrubOutputTest < Test::Unit::TestCase
|
|
135
135
|
def test_emit3_struct_message
|
136
136
|
orig_message = 'testtesttest'
|
137
137
|
invalid_utf8 = "\xff".force_encoding('UTF-8')
|
138
|
-
d1 = create_driver(CONFIG_REPLACE_CHAR
|
139
|
-
d1.run do
|
140
|
-
d1.
|
138
|
+
d1 = create_driver(CONFIG_REPLACE_CHAR)
|
139
|
+
d1.run(default_tag: 'input.log') do
|
140
|
+
d1.feed({'message' => {'message_child' => orig_message + invalid_utf8}})
|
141
141
|
end
|
142
|
-
emits = d1.
|
142
|
+
emits = d1.events
|
143
143
|
assert_equal 1, emits.length
|
144
144
|
|
145
145
|
e1 = emits[0]
|
@@ -150,11 +150,11 @@ class StringScrubOutputTest < Test::Unit::TestCase
|
|
150
150
|
def test_emit4_unicode1
|
151
151
|
orig_message = 'testtesttest'
|
152
152
|
invalid_utf8 = "\xff".force_encoding('UTF-8')
|
153
|
-
d1 = create_driver(CONFIG_UNICODE_1
|
154
|
-
d1.run do
|
155
|
-
d1.
|
153
|
+
d1 = create_driver(CONFIG_UNICODE_1)
|
154
|
+
d1.run(default_tag: 'input.log') do
|
155
|
+
d1.feed({'message' => {'message_child' => orig_message + invalid_utf8}})
|
156
156
|
end
|
157
|
-
emits = d1.
|
157
|
+
emits = d1.events
|
158
158
|
assert_equal 1, emits.length
|
159
159
|
|
160
160
|
e1 = emits[0]
|
@@ -163,15 +163,56 @@ class StringScrubOutputTest < Test::Unit::TestCase
|
|
163
163
|
|
164
164
|
orig_message = 'testtesttest'
|
165
165
|
invalid_utf8 = "\xff".force_encoding('UTF-8')
|
166
|
-
d1 = create_driver(CONFIG_UNICODE_2
|
167
|
-
d1.run do
|
168
|
-
d1.
|
166
|
+
d1 = create_driver(CONFIG_UNICODE_2)
|
167
|
+
d1.run(default_tag: 'input.log') do
|
168
|
+
d1.feed({'message' => {'message_child' => orig_message + invalid_utf8}})
|
169
169
|
end
|
170
|
-
emits = d1.
|
170
|
+
emits = d1.events
|
171
171
|
assert_equal 1, emits.length
|
172
172
|
|
173
173
|
e1 = emits[0]
|
174
174
|
assert_equal "scrubbed.log", e1[0]
|
175
175
|
assert_equal orig_message + "\uFFFD".force_encoding('UTF-8'), e1[2]['message']['message_child']
|
176
176
|
end
|
177
|
+
|
178
|
+
def test_emit5_frozen_string
|
179
|
+
orig_message = 'testtesttest'
|
180
|
+
invalid_utf8 = "\xff".force_encoding('UTF-8')
|
181
|
+
d1 = create_driver(CONFIG)
|
182
|
+
d1.run(default_tag: 'input.log') do
|
183
|
+
d1.feed({'message' => (orig_message + invalid_utf8).freeze})
|
184
|
+
end
|
185
|
+
emits = d1.events
|
186
|
+
assert_equal 1, emits.length
|
187
|
+
|
188
|
+
e1 = emits[0]
|
189
|
+
assert_equal "scrubbed.log", e1[0]
|
190
|
+
assert_equal orig_message, e1[2]['message']
|
191
|
+
|
192
|
+
invalid_ascii = "\xff".force_encoding('US-ASCII')
|
193
|
+
d2 = create_driver(CONFIG)
|
194
|
+
d2.run(default_tag: 'input.log2') do
|
195
|
+
d2.feed({'message' => (orig_message + invalid_utf8).freeze})
|
196
|
+
end
|
197
|
+
emits = d2.events
|
198
|
+
assert_equal 1, emits.length
|
199
|
+
|
200
|
+
e2 = emits[0]
|
201
|
+
assert_equal "scrubbed.log2", e2[0]
|
202
|
+
assert_equal orig_message, e2[2]['message']
|
203
|
+
end
|
204
|
+
|
205
|
+
def test_emit6_integer
|
206
|
+
orig_message = 123456789
|
207
|
+
d1 = create_driver(CONFIG)
|
208
|
+
d1.run(default_tag: 'input.log') do
|
209
|
+
d1.feed({'message' => orig_message})
|
210
|
+
end
|
211
|
+
emits = d1.events
|
212
|
+
assert_equal 1, emits.length
|
213
|
+
|
214
|
+
e1 = emits[0]
|
215
|
+
assert_equal "scrubbed.log", e1[0]
|
216
|
+
assert_equal orig_message, e1[2]['message']
|
217
|
+
end
|
177
218
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-string-scrub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noriaki Katayama
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -44,14 +44,20 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 0.14.0
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '2'
|
48
51
|
type: :development
|
49
52
|
prerelease: false
|
50
53
|
version_requirements: !ruby/object:Gem::Requirement
|
51
54
|
requirements:
|
52
55
|
- - ">="
|
53
56
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
57
|
+
version: 0.14.0
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '2'
|
55
61
|
description: fluent plugin for string scrub.
|
56
62
|
email:
|
57
63
|
- kataring@gmail.com
|
@@ -66,14 +72,16 @@ files:
|
|
66
72
|
- README.md
|
67
73
|
- Rakefile
|
68
74
|
- fluent-plugin-string-scrub.gemspec
|
75
|
+
- lib/fluent/plugin/filter_string_scrub.rb
|
69
76
|
- lib/fluent/plugin/out_string_scrub.rb
|
70
77
|
- test/helper.rb
|
78
|
+
- test/plugin/test_filter_string-scrub.rb
|
71
79
|
- test/plugin/test_out_string-scrub.rb
|
72
80
|
homepage: https://github.com/kataring/fluent-plugin-string-scrub
|
73
81
|
licenses:
|
74
82
|
- MIT
|
75
83
|
metadata: {}
|
76
|
-
post_install_message:
|
84
|
+
post_install_message:
|
77
85
|
rdoc_options: []
|
78
86
|
require_paths:
|
79
87
|
- lib
|
@@ -81,18 +89,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
81
89
|
requirements:
|
82
90
|
- - ">="
|
83
91
|
- !ruby/object:Gem::Version
|
84
|
-
version: '
|
92
|
+
version: '2.1'
|
85
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
94
|
requirements:
|
87
95
|
- - ">="
|
88
96
|
- !ruby/object:Gem::Version
|
89
97
|
version: '0'
|
90
98
|
requirements: []
|
91
|
-
|
92
|
-
|
93
|
-
signing_key:
|
99
|
+
rubygems_version: 3.2.22
|
100
|
+
signing_key:
|
94
101
|
specification_version: 4
|
95
102
|
summary: Fluentd Output filter plugin.
|
96
103
|
test_files:
|
97
104
|
- test/helper.rb
|
105
|
+
- test/plugin/test_filter_string-scrub.rb
|
98
106
|
- test/plugin/test_out_string-scrub.rb
|