Skip to content

Commit

Permalink
Merge pull request #2921 from ganmacs/pos_file_compaction_interval
Browse files Browse the repository at this point in the history
Fix pos_file_compaction_interval type
  • Loading branch information
ganmacs authored Mar 31, 2020
2 parents 5e59ec3 + 960ecf1 commit 297696b
Show file tree
Hide file tree
Showing 2 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 @@ -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

0 comments on commit 297696b

Please sign in to comment.