fluent-plugin-string-scrub 0.0.2 → 0.0.3

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cdab445162d666c325c977971529e5eb25a4ffc0
4
+ data.tar.gz: f7eeafe31bdaf17e838db80b51e232167391ce31
5
+ SHA512:
6
+ metadata.gz: f850bc87770dcec1b61e92392bf7f2ba075cbbea2782c0e8a1b9b8cb65b90c7977ac1868c1500a35efeba272045606b1e9fc7842990823c443f2d2821312ffb6
7
+ data.tar.gz: 3f8e0e2d4d51811b69cef252a55d18a635d151794716b04661d55537138b17e1b6ab6e523272e1103a0f63bfe7089492c1103159f845e1589a68a7ca6362584a
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # fluent-plugin-string-scrub [![Build Status](https://travis-ci.org/kataring/fluent-plugin-string-scrub.svg)](https://travis-ci.org/kataring/fluent-plugin-string-scrub)
1
+ # fluent-plugin-string-scrub [![Gem Version](https://badge.fury.io/rb/fluent-plugin-string-scrub.svg)](http://badge.fury.io/rb/fluent-plugin-string-scrub) [![Build Status](https://travis-ci.org/kataring/fluent-plugin-string-scrub.svg)](https://travis-ci.org/kataring/fluent-plugin-string-scrub)
2
2
 
3
3
  fluent plugin for string scrub.
4
4
 
@@ -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.2"
6
+ spec.version = "0.0.3"
7
7
  spec.authors = ["Noriaki Katayama"]
8
8
  spec.email = ["kataring@gmail.com"]
9
9
  spec.summary = %q{Fluentd Output filter plugin.}
@@ -27,9 +27,8 @@ class Fluent::StringScrubOutput < Fluent::Output
27
27
  if @add_prefix
28
28
  @added_prefix_string = @add_prefix + '.'
29
29
  end
30
-
31
- if @replace_char and @replace_char.length >= 2
32
- raise Fluent::ConfigError, "replace_char: mast be 1 character"
30
+ if @replace_char =~ /\\u\{*[A-F0-9]{4}\}*/
31
+ @replace_char = eval("\"#{@replace_char}\"")
33
32
  end
34
33
  end
35
34
 
@@ -16,6 +16,18 @@ class StringScrubOutputTest < Test::Unit::TestCase
16
16
  replace_char ?
17
17
  ]
18
18
 
19
+ CONFIG_UNICODE_1 = %[
20
+ remove_prefix input
21
+ add_prefix scrubbed
22
+ replace_char \uFFFD
23
+ ]
24
+
25
+ CONFIG_UNICODE_2 = %[
26
+ remove_prefix input
27
+ add_prefix scrubbed
28
+ replace_char \u{FFFD}
29
+ ]
30
+
19
31
  def create_driver(conf=CONFIG,tag='test')
20
32
  Fluent::Test::OutputTestDriver.new(Fluent::StringScrubOutput, tag).configure(conf)
21
33
  end
@@ -119,4 +131,47 @@ class StringScrubOutputTest < Test::Unit::TestCase
119
131
  assert_equal "scrubbed.log2", e2[0]
120
132
  assert_equal orig_message + '?', e2[2]['message']
121
133
  end
134
+
135
+ def test_emit3_struct_message
136
+ orig_message = 'testtesttest'
137
+ invalid_utf8 = "\xff".force_encoding('UTF-8')
138
+ d1 = create_driver(CONFIG_REPLACE_CHAR, 'input.log')
139
+ d1.run do
140
+ d1.emit({'message' => {'message_child' => orig_message + invalid_utf8}})
141
+ end
142
+ emits = d1.emits
143
+ assert_equal 1, emits.length
144
+
145
+ e1 = emits[0]
146
+ assert_equal "scrubbed.log", e1[0]
147
+ assert_equal orig_message + '?', e1[2]['message']['message_child']
148
+ end
149
+
150
+ def test_emit4_unicode1
151
+ orig_message = 'testtesttest'
152
+ invalid_utf8 = "\xff".force_encoding('UTF-8')
153
+ d1 = create_driver(CONFIG_UNICODE_1, 'input.log')
154
+ d1.run do
155
+ d1.emit({'message' => {'message_child' => orig_message + invalid_utf8}})
156
+ end
157
+ emits = d1.emits
158
+ assert_equal 1, emits.length
159
+
160
+ e1 = emits[0]
161
+ assert_equal "scrubbed.log", e1[0]
162
+ assert_equal orig_message + "\uFFFD".force_encoding('UTF-8'), e1[2]['message']['message_child']
163
+
164
+ orig_message = 'testtesttest'
165
+ invalid_utf8 = "\xff".force_encoding('UTF-8')
166
+ d1 = create_driver(CONFIG_UNICODE_2, 'input.log')
167
+ d1.run do
168
+ d1.emit({'message' => {'message_child' => orig_message + invalid_utf8}})
169
+ end
170
+ emits = d1.emits
171
+ assert_equal 1, emits.length
172
+
173
+ e1 = emits[0]
174
+ assert_equal "scrubbed.log", e1[0]
175
+ assert_equal orig_message + "\uFFFD".force_encoding('UTF-8'), e1[2]['message']['message_child']
176
+ end
122
177
  end
metadata CHANGED
@@ -1,80 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-string-scrub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Noriaki Katayama
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-01-27 00:00:00.000000000 Z
11
+ date: 2015-02-09 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: test-unit
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: fluentd
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: string-scrub
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ~>
68
- - !ruby/object:Gem::Version
69
- version: 0.0.5
70
- type: :runtime
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- version: 0.0.5
78
55
  description: fluent plugin for string scrub.
79
56
  email:
80
57
  - kataring@gmail.com
@@ -82,8 +59,8 @@ executables: []
82
59
  extensions: []
83
60
  extra_rdoc_files: []
84
61
  files:
85
- - .gitignore
86
- - .travis.yml
62
+ - ".gitignore"
63
+ - ".travis.yml"
87
64
  - Gemfile
88
65
  - LICENSE.txt
89
66
  - README.md
@@ -95,27 +72,26 @@ files:
95
72
  homepage: https://github.com/kataring/fluent-plugin-string-scrub
96
73
  licenses:
97
74
  - MIT
75
+ metadata: {}
98
76
  post_install_message:
99
77
  rdoc_options: []
100
78
  require_paths:
101
79
  - lib
102
80
  required_ruby_version: !ruby/object:Gem::Requirement
103
- none: false
104
81
  requirements:
105
- - - ! '>='
82
+ - - ">="
106
83
  - !ruby/object:Gem::Version
107
84
  version: '0'
108
85
  required_rubygems_version: !ruby/object:Gem::Requirement
109
- none: false
110
86
  requirements:
111
- - - ! '>='
87
+ - - ">="
112
88
  - !ruby/object:Gem::Version
113
89
  version: '0'
114
90
  requirements: []
115
91
  rubyforge_project:
116
- rubygems_version: 1.8.23.2
92
+ rubygems_version: 2.2.2
117
93
  signing_key:
118
- specification_version: 3
94
+ specification_version: 4
119
95
  summary: Fluentd Output filter plugin.
120
96
  test_files:
121
97
  - test/helper.rb