fluent-plugin-rewrite 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "fluent-plugin-rewrite"
3
- gem.version = '0.0.6'
3
+ gem.version = '0.0.7'
4
4
  gem.authors = ["Kentaro Kuribayashi"]
5
5
  gem.email = ["kentarok@gmail.com"]
6
6
  gem.homepage = "http://github.com/kentaro/fluent-plugin-rewrite"
@@ -51,8 +51,8 @@ module Fluent
51
51
  end
52
52
 
53
53
  es.each do |time, record|
54
- filtered_tag, record = rewrite(tag, record)
55
- Engine.emit(filtered_tag, time, record) if (filtered_tag && record) && (filtered_tag != tag)
54
+ tag, record = rewrite(tag, record)
55
+ Engine.emit(tag, time, record) if tag && record
56
56
  end
57
57
 
58
58
  chain.next
@@ -247,7 +247,7 @@ class RewriteOutputTest < Test::Unit::TestCase
247
247
  end
248
248
 
249
249
  def test_emit
250
- d = create_driver(%[
250
+ d1 = create_driver(%[
251
251
  remove_prefix test
252
252
  add_prefix filtered
253
253
 
@@ -269,14 +269,14 @@ class RewriteOutputTest < Test::Unit::TestCase
269
269
  </rule>
270
270
  ])
271
271
 
272
- d.run do
273
- d.emit({ "path" => "/foo?bar=1" })
274
- d.emit({ "path" => "/foo?bar=1", "status" => "500" })
275
- d.emit({ "path" => "/users/antipop" })
276
- d.emit({ "path" => "/users/kentaro" })
277
- d.emit({ "path" => "/entries/1" })
272
+ d1.run do
273
+ d1.emit({ "path" => "/foo?bar=1" })
274
+ d1.emit({ "path" => "/foo?bar=1", "status" => "500" })
275
+ d1.emit({ "path" => "/users/antipop" })
276
+ d1.emit({ "path" => "/users/kentaro" })
277
+ d1.emit({ "path" => "/entries/1" })
278
278
  end
279
- emits = d.emits
279
+ emits = d1.emits
280
280
 
281
281
  assert_equal 4, emits.size
282
282
  assert_equal('filtered.others', emits[0][0])
@@ -287,5 +287,21 @@ class RewriteOutputTest < Test::Unit::TestCase
287
287
  assert_equal({ "path" => "/users/kentaro" }, emits[2][2])
288
288
  assert_equal('filtered.entries', emits[3][0])
289
289
  assert_equal({ "path" => "/entries/1" }, emits[3][2])
290
+
291
+ d2 = create_driver(%[
292
+ <rule>
293
+ key path
294
+ pattern \\?.+$
295
+ replace
296
+ </rule>
297
+ ])
298
+ d2.run do
299
+ d2.emit({ "path" => "/foo?bar=1" })
300
+ end
301
+ emits = d2.emits
302
+
303
+ assert_equal 1, emits.size
304
+ assert_equal('test', emits[0][0])
305
+ assert_equal({ "path" => "/foo" }, emits[0][2])
290
306
  end
291
307
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-rewrite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: