diff --git a/lib/fluent/plugin/in_tail.rb b/lib/fluent/plugin/in_tail.rb index 56d1058e0e..968b352d86 100644 --- a/lib/fluent/plugin/in_tail.rb +++ b/lib/fluent/plugin/in_tail.rb @@ -184,7 +184,7 @@ def expand_paths path = date.strftime(path) if path.include?('*') paths += Dir.glob(path).select { |p| - if File.readable?(p) + if File.readable?(p) && !File.directory?(p) true else log.warn "#{p} unreadable. It is excluded and would be examined next time." diff --git a/test/plugin/data/log/foo/bar2 b/test/plugin/data/log/foo/bar2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/plugin/test_in_tail.rb b/test/plugin/test_in_tail.rb index 83851ad360..98dbf12278 100644 --- a/test/plugin/test_in_tail.rb +++ b/test/plugin/test_in_tail.rb @@ -847,6 +847,25 @@ def test_expand_paths plugin = create_driver(exclude_config, false).instance assert_equal EX_PATHS - [EX_PATHS.last], plugin.expand_paths.sort end + + def test_log_file_without_extension + expected_files = [ + 'test/plugin/data/log/bar', + 'test/plugin/data/log/foo/bar.log', + 'test/plugin/data/log/foo/bar2', + 'test/plugin/data/log/test.log' + ] + + config = config_element("", "", { + "tag" => "tail", + "path" => "test/plugin/data/log/**/*", + "format" => "none", + "pos_file" => "#{TMP_DIR}/tail.pos" + }) + + plugin = create_driver(config, false).instance + assert_equal expected_files, plugin.expand_paths.sort + end end def test_z_refresh_watchers