Class: Fluent::RamblerOutput

Inherits:
S3Output
  • Object
show all
Defined in:
lib/fluent/plugin/out_rambler.rb

Instance Method Summary collapse

Constructor Details

#initializeRamblerOutput

Returns a new instance of RamblerOutput.



35
36
37
# File 'lib/fluent/plugin/out_rambler.rb', line 35

def initialize
  super
end

Instance Method Details

#configure(conf) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/fluent/plugin/out_rambler.rb', line 39

def configure(conf)
  super

  unless ['gzip', 'txt'].include? @store_as
    raise ConfigError, "only 'gzip' or 'txt' is allowed for store_as: #{@store_as}"
  end

  @separator = '|'
  @columns = @columns.split(@separator)
end

#format(tag, time, record) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/fluent/plugin/out_rambler.rb', line 50

def format(tag, time, record)
  super

  @columns.map {|name|
    if name == '%{time}'
      # timestamp
      if @localtime
        Time.at(time).strftime(@time_format)
      else
        Time.at(time).utc.strftime(@time_format)
      end
    else
      # record value
      record[name].to_s
    end
  }.join(@separator) + "\n"
end