Module: Fluent::Plugin::FileOutput::SymlinkBufferMixin

Defined in:
lib/fluent/plugin/out_file.rb

Instance Method Summary collapse

Instance Method Details

#generate_chunk(metadata) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/fluent/plugin/out_file.rb', line 77

def generate_chunk()
  chunk = super
  # "symlink" feature is to link from symlink_path to the latest file chunk. Records with latest
  # timekey will be appended into that file chunk. On the other side, resumed file chunks might NOT
  # have timekey, especially in the cases that resumed file chunks are generated by Fluentd v0.12.
  # These chunks will be enqueued immediately, and will be flushed soon.
   = .select{|m| m.timekey }.sort_by(&:timekey).last
  if chunk. == 
    FileUtils.ln_sf(chunk.path, @_symlink_path)
  end
  chunk
end


73
74
75
# File 'lib/fluent/plugin/out_file.rb', line 73

def symlink_path=(path)
  @_symlink_path = path
end