class LogStash::Outputs::Gcs::PlainLogFile

PlainLogFile writes events to a plain text file.

Attributes

fd[R]
path[R]

Public Class Methods

new(path) click to toggle source
# File lib/logstash/outputs/gcs/temp_log_file.rb, line 27
def initialize(path)
  @path = path
  @fd = ::File.new(path, 'a+')
  @last_sync = Time.now
end

Public Instance Methods

close!() click to toggle source
# File lib/logstash/outputs/gcs/temp_log_file.rb, line 42
def close!
  @fd.fsync
  @fd.close
end
fsync() click to toggle source
# File lib/logstash/outputs/gcs/temp_log_file.rb, line 37
def fsync
  @fd.fsync
  @last_sync = Time.now
end
size() click to toggle source
# File lib/logstash/outputs/gcs/temp_log_file.rb, line 47
def size
  ::File.stat(@path).size
end
time_since_sync() click to toggle source
# File lib/logstash/outputs/gcs/temp_log_file.rb, line 51
def time_since_sync
  Time.now - @last_sync
end
write(*contents) click to toggle source
# File lib/logstash/outputs/gcs/temp_log_file.rb, line 33
def write(*contents)
  contents.each { |c| @fd.write(c) }
end