lib/fluent/plugin/out_splunkapi.rb in fluent-plugin-splunkapi-0.1.0 vs lib/fluent/plugin/out_splunkapi.rb in fluent-plugin-splunkapi-0.1.1
- old
+ new
@@ -42,11 +42,11 @@
config_param :host, :string, :default => nil # TODO: auto-detect
config_param :source, :string, :default => '{TAG}'
config_param :sourcetype, :string, :default => 'fluent'
# Formatting
- config_param :time_format, :string, :default => "%Y-%M-%d %H:%M:%S"
+ config_param :time_format, :string, :default => 'localtime'
config_param :format, :string, :default => 'json'
def initialize
super
require 'net/http/persistent'
@@ -66,9 +66,11 @@
case @time_format
when 'none'
@time_formatter = nil
when 'unixtime'
@time_formatter = lambda { |time| time.to_s }
+ when 'localtime'
+ @time_formatter = lambda { |time| Time.at(time).localtime }
else
@timef = TimeFormatter.new(@time_format, @localtime)
@time_formatter = lambda { |time| @timef.format(time) }
end