Skip to content

Commit

Permalink
in_tail: Fix the error when 'tag *' is configured. fix #1512
Browse files Browse the repository at this point in the history
  • Loading branch information
repeatedly committed Aug 16, 2017
1 parent c7e94e8 commit 3a1a1e8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/fluent/plugin/in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def configure(conf)
def configure_tag
if @tag.index('*')
@tag_prefix, @tag_suffix = @tag.split('*')
@tag_prefix ||= ''
@tag_suffix ||= ''
else
@tag_prefix = nil
Expand Down
14 changes: 14 additions & 0 deletions test/plugin/test_in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,20 @@ def test_tag
plugin.receive_lines(['foo', 'bar'], DummyWatcher.new('foo.bar.log'))
end

def test_tag_with_only_star
config = config_element("", "", {
"tag" => "*",
"path" => "test/plugin/*/%Y/%m/%Y%m%d-%H%M%S.log,test/plugin/data/log/**/*.log",
"format" => "none",
"read_from_head" => true
})
d = create_driver(config, false)
d.run {}
plugin = d.instance
mock(plugin.router).emit_stream('foo.bar.log', anything).once
plugin.receive_lines(['foo', 'bar'], DummyWatcher.new('foo.bar.log'))
end

def test_tag_prefix
config = config_element("", "", {
"tag" => "pre.*",
Expand Down

0 comments on commit 3a1a1e8

Please sign in to comment.