Skip to content

Commit

Permalink
change tag replace order
Browse files Browse the repository at this point in the history
  • Loading branch information
hotchpotch authored and frsyuki committed Mar 30, 2012
1 parent 7f1fa6b commit 566e8a7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/fluent/mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ def configure(conf)
end

def filter_record(tag, time, record)
tag = tag.insert(0, @add_tag_prefix) if @add_tag_prefix
tag << @add_tag_suffix if @add_tag_suffix
tag.sub!(@remove_tag_prefix, '') if @remove_tag_prefix
tag.sub!(@remove_tag_suffix, '') if @remove_tag_suffix
tag.insert(0, @add_tag_prefix) if @add_tag_prefix
tag << @add_tag_suffix if @add_tag_suffix
super(tag, time, record)
end
end
Expand Down
14 changes: 14 additions & 0 deletions test/mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,20 @@ def test_remove_tag_suffix
d.run
end

def test_mix_tag_handle
format_check({
'a' => 1
}, 'prefix.t')

d = create_driver(Fluent::HandleTagNameMixin, %[
remove_tag_prefix tes
add_tag_prefix prefix.
])

d.emit({'a' => 1})
d.run
end

def test_with_set_tag_key_mixin
format_check({
'tag' => 'tag_prefix.test',
Expand Down

0 comments on commit 566e8a7

Please sign in to comment.