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 pos_file_compaction_interval type #2921

Merged
merged 1 commit into from
Mar 31, 2020
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 @@ -70,7 +70,7 @@ def initialize
desc 'Fluentd will record the position it last read into this file.'
config_param :pos_file, :string, default: nil
desc 'The cleanup interval of pos file'
config_param :pos_file_compaction_interval, :integer, default: nil
config_param :pos_file_compaction_interval, :time, default: nil
desc 'Start to read the logs from the head of file, not bottom.'
config_param :read_from_head, :bool, default: false
# When the program deletes log file and re-creates log file with same filename after passed refresh_interval,
Expand Down
19 changes: 19 additions & 0 deletions test/plugin/test_in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,25 @@ def test_z_refresh_watchers
end
end

sub_test_case "refresh of pos file" do
test 'type of pos_file_compaction_interval is time' do
tail = {
"tag" => "tail",
"path" => "#{TMP_DIR}/*.txt",
"format" => "none",
"pos_file" => "#{TMP_DIR}/pos/tail.pos",
"refresh_interval" => 1,
"read_from_head" => true,
'pos_file_compaction_interval' => '24h',
}
config = config_element("", "", tail)
d = create_driver(config, false)
mock(d.instance).timer_execute(:in_tail_refresh_watchers, 1.0).once
mock(d.instance).timer_execute(:in_tail_refresh_compact_pos_file, 60 * 60 * 24).once
d.run # call start
end
end

sub_test_case "receive_lines" do
DummyWatcher = Struct.new("DummyWatcher", :tag)

Expand Down