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 committed Mar 3, 2017
1 parent 6fc58dd commit ba84f03
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 @@ -153,7 +153,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 @@ -697,6 +697,25 @@ def test_expand_paths
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

def test_refresh_watchers
plugin = create_driver(EX_CONFIG, false).instance
sio = StringIO.new
Expand Down

0 comments on commit ba84f03

Please sign in to comment.