Skip to content

Commit

Permalink
Merge pull request #1464 from angry-cellophane/master
Browse files Browse the repository at this point in the history
Fix issue #1451. The in_tail plugin tries to tail directories when th…
  • Loading branch information
repeatedly authored Feb 14, 2017
2 parents e221494 + ab76ed0 commit 3e3ff24
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fluent/plugin/in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
Empty file added test/plugin/data/log/foo/bar2
Empty file.
19 changes: 19 additions & 0 deletions test/plugin/test_in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3e3ff24

Please sign in to comment.