fluent-plugin-string-scrub 1.0.0 → 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 +4 -4
- data/.travis.yml +4 -1
- data/README.md +7 -7
- data/fluent-plugin-string-scrub.gemspec +1 -1
- data/lib/fluent/plugin/filter_string_scrub.rb +3 -1
- data/lib/fluent/plugin/out_string_scrub.rb +2 -0
- data/test/plugin/test_filter_string-scrub.rb +13 -0
- data/test/plugin/test_out_string-scrub.rb +14 -0
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
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
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,17 +37,17 @@ 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
|
|
@@ -57,16 +57,16 @@ Fluentd >= v0.12 can use filter plugin.
|
|
57
57
|
|
58
58
|
```
|
59
59
|
<source>
|
60
|
-
type forward
|
60
|
+
@type forward
|
61
61
|
</source>
|
62
62
|
|
63
63
|
<filter **>
|
64
|
-
type string_scrub
|
64
|
+
@type string_scrub
|
65
65
|
replace_char ?
|
66
66
|
</filter>
|
67
67
|
|
68
68
|
<match **>
|
69
|
-
type stdout
|
69
|
+
@type stdout
|
70
70
|
</match>
|
71
71
|
```
|
72
72
|
|
@@ -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 = "1.0.
|
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.}
|
@@ -23,7 +23,7 @@ class Fluent::Plugin::StringScrubFilter < Fluent::Plugin::Filter
|
|
23
23
|
begin
|
24
24
|
scrubbed = recv_record(record)
|
25
25
|
next if scrubbed.nil?
|
26
|
-
new_es.add(time,
|
26
|
+
new_es.add(time, scrubbed)
|
27
27
|
rescue => e
|
28
28
|
router.emit_error_event(tag, time, record, e)
|
29
29
|
end
|
@@ -37,6 +37,8 @@ class Fluent::Plugin::StringScrubFilter < Fluent::Plugin::Filter
|
|
37
37
|
record.each do |k,v|
|
38
38
|
if v.instance_of? Hash
|
39
39
|
scrubbed[with_scrub(k)] = recv_record(v)
|
40
|
+
elsif v.instance_of? Integer
|
41
|
+
scrubbed[k] = v
|
40
42
|
else
|
41
43
|
scrubbed[with_scrub(k)] = with_scrub(v)
|
42
44
|
end
|
@@ -68,6 +68,8 @@ class Fluent::Plugin::StringScrubOutput < Fluent::Plugin::Output
|
|
68
68
|
record.each do |k,v|
|
69
69
|
if v.instance_of? Hash
|
70
70
|
scrubbed[with_scrub(k)] = recv_record(v)
|
71
|
+
elsif v.instance_of? Integer
|
72
|
+
scrubbed[k] = v
|
71
73
|
else
|
72
74
|
scrubbed[with_scrub(k)] = with_scrub(v)
|
73
75
|
end
|
@@ -43,4 +43,17 @@ class StringScrubFilterTest < Test::Unit::TestCase
|
|
43
43
|
assert_equal([{"message" => orig_message + '?'}], filtered)
|
44
44
|
end
|
45
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
|
46
59
|
end
|
@@ -201,4 +201,18 @@ class StringScrubOutputTest < Test::Unit::TestCase
|
|
201
201
|
assert_equal "scrubbed.log2", e2[0]
|
202
202
|
assert_equal orig_message, e2[2]['message']
|
203
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
|
204
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: 1.0.
|
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
|
@@ -81,7 +81,7 @@ homepage: https://github.com/kataring/fluent-plugin-string-scrub
|
|
81
81
|
licenses:
|
82
82
|
- MIT
|
83
83
|
metadata: {}
|
84
|
-
post_install_message:
|
84
|
+
post_install_message:
|
85
85
|
rdoc_options: []
|
86
86
|
require_paths:
|
87
87
|
- lib
|
@@ -96,9 +96,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
requirements: []
|
99
|
-
|
100
|
-
|
101
|
-
signing_key:
|
99
|
+
rubygems_version: 3.2.22
|
100
|
+
signing_key:
|
102
101
|
specification_version: 4
|
103
102
|
summary: Fluentd Output filter plugin.
|
104
103
|
test_files:
|