Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #1451. The in_tail plugin tries to tail directories when th… #1464

Merged
merged 1 commit into from
Feb 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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