fluent-plugin-string-scrub 0.0.3 → 0.0.4
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73d0da5e8e95386a46ed8d332e3ad698448b2c5f
|
4
|
+
data.tar.gz: 64bd7f44ed8164404d4793c6c947f8dff9cd86ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c960490269222cdc16e9ce8d5c1addd1747436b73ed0cc9ef099c0d33989ec148cf9f133620b03f25cb9d070a996ec9dfff110b61f3e71891ae870be56d23aeb
|
7
|
+
data.tar.gz: 0b1443b6c15cd8ae04915f73230ca9287a2b0b033c266a446ad97eaa958ac488c07095d3336e8b43f6b99ce89e434ef85ab004e8fe908bf5f4d8ebf420560d0f
|
@@ -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 = "0.0.
|
6
|
+
spec.version = "0.0.4"
|
7
7
|
spec.authors = ["Noriaki Katayama"]
|
8
8
|
spec.email = ["kataring@gmail.com"]
|
9
9
|
spec.summary = %q{Fluentd Output filter plugin.}
|
@@ -77,7 +77,11 @@ class Fluent::StringScrubOutput < Fluent::Output
|
|
77
77
|
return string
|
78
78
|
rescue ArgumentError => e
|
79
79
|
raise e unless e.message.index("invalid byte sequence in") == 0
|
80
|
-
string.
|
80
|
+
if string.frozen?
|
81
|
+
string = string.dup.scrub!(@replace_char)
|
82
|
+
else
|
83
|
+
string.scrub!(@replace_char)
|
84
|
+
end
|
81
85
|
retry
|
82
86
|
end
|
83
87
|
end
|
@@ -174,4 +174,31 @@ class StringScrubOutputTest < Test::Unit::TestCase
|
|
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, 'input.log')
|
182
|
+
d1.run do
|
183
|
+
d1.emit({'message' => (orig_message + invalid_utf8).freeze})
|
184
|
+
end
|
185
|
+
emits = d1.emits
|
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, 'input.log2')
|
194
|
+
d2.run do
|
195
|
+
d2.emit({'message' => (orig_message + invalid_utf8).freeze})
|
196
|
+
end
|
197
|
+
emits = d2.emits
|
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
|
177
204
|
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: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noriaki Katayama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|