Skip to content

Commit

Permalink
in_tail: Use always instead of extended to prepare future extending
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Mar 26, 2024
1 parent 1b478b2 commit 2d6c6cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/fluent/plugin/in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def initialize
desc 'path delimiter used for spliting path config'
config_param :path_delimiter, :string, default: ','
desc 'Choose using glob patterns. Adding whether a capability to handle [] and ? or not.'
config_param :enable_glob, :enum, list: [:with_wildcards, :extended], default: :with_wildcards
config_param :enable_glob, :enum, list: [:with_wildcards, :always], default: :with_wildcards
desc 'The tag of the event.'
config_param :tag, :string
desc 'The paths to exclude the files from watcher list.'
Expand Down Expand Up @@ -288,7 +288,7 @@ def have_read_capability?
# Curly braces is not supported for now because the default delimiter of path is ",".
# This should be collided for wildcard pattern for curly braces.
def use_glob?(path)
if @enable_glob == :extended
if @enable_glob == :always
path.include?('*') || path.include?('?') || /\[.*\]/.match(path)
elsif @enable_glob == :with_wildcards
path.include?('*')
Expand Down
8 changes: 4 additions & 4 deletions test/plugin/test_in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1540,9 +1540,9 @@ def test_expand_paths

sub_test_case "expand_paths with glob" do |data|
sub_test_case "extended_glob" do
data("square brackets" => [true, "extended", "test/plugin/data/log_numeric/[0-1][2-4].log"],
"asterisk" => [true, "extended", "test/plugin/data/log/*.log"],
"one character matcher" => [true, "extended", "test/plugin/data/log/tes?.log"],
data("square brackets" => [true, "always", "test/plugin/data/log_numeric/[0-1][2-4].log"],
"asterisk" => [true, "always", "test/plugin/data/log/*.log"],
"one character matcher" => [true, "always", "test/plugin/data/log/tes?.log"],
)
def test_expand_paths_with_use_glob_p
result, option, path = data
Expand Down Expand Up @@ -1594,7 +1594,7 @@ def ex_config_with_brackets
"pos_file" => "#{@tmp_dir}/tail.pos",
"read_from_head" => true,
"refresh_interval" => 30,
"enable_glob" => "extended",
"enable_glob" => "always",
"rotate_wait" => "#{EX_ROTATE_WAIT}s",
"follow_inodes" => "#{EX_FOLLOW_INODES}",
})
Expand Down

0 comments on commit 2d6c6cf

Please sign in to comment.