fluent-plugin-rewrite 0.0.6 → 0.0.7
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.
@@ -51,8 +51,8 @@ module Fluent
|
|
51
51
|
end
|
52
52
|
|
53
53
|
es.each do |time, record|
|
54
|
-
|
55
|
-
Engine.emit(
|
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
|
-
|
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
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
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 =
|
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
|