Skip to content

Commit

Permalink
Merge pull request #1664 from fluent/in_tail-fix-tag-with-only-star
Browse files Browse the repository at this point in the history
in_tail: Fix the error when 'tag *' is configured. fix #1512
  • Loading branch information
repeatedly committed Aug 23, 2017
1 parent 4441ec7 commit b66b62e
Show file tree
Hide file tree
Showing 2 changed files with 13 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 @@ -101,6 +101,7 @@ def configure_parser(conf)
def configure_tag
if @tag.index('*')
@tag_prefix, @tag_suffix = @tag.split('*')
@tag_prefix ||= ''
@tag_suffix ||= ''
else
@tag_prefix = nil
Expand Down
12 changes: 12 additions & 0 deletions test/plugin/test_in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,18 @@ def test_receive_lines
engineclass.should_receive(:emit_stream).with('pre.foo.bar.log.post', any).once
plugin.receive_lines(['foo', 'bar'], DummyWatcher.new('foo.bar.log'))
end

config = %[
tag *
path test/plugin/*/%Y/%m/%Y%m%d-%H%M%S.log,test/plugin/data/log/**/*.log
format none
read_from_head true
]
plugin = create_driver(config, false).instance
flexstub(plugin.router) do |engineclass|
engineclass.should_receive(:emit_stream).with('foo.bar.log', any).once
plugin.receive_lines(['foo', 'bar'], DummyWatcher.new('foo.bar.log'))
end
end

# Ensure that no fatal exception is raised when a file is missing and that
Expand Down

0 comments on commit b66b62e

Please sign in to comment.