module Fluent::Plugin::FileOutput::SymlinkBufferMixin

Public Instance Methods

generate_chunk(metadata) click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_file.rb, line 78
def generate_chunk(metadata)
  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.
  latest_metadata = metadata_list.select{|m| m.timekey }.sort_by(&:timekey).last
  if chunk.metadata == latest_metadata
    FileUtils.ln_sf(chunk.path, @_symlink_path)
  end
  chunk
end