lib/fluent/plugin/out_elasticsearch.rb
# once fluent v0.14 is released we might be able to use
# Fluent::Parser::TimeParser, but it doesn't quite do what we want - if gives
# [sec,nsec] where as we want something we can call `strftime` on...
once fluent v0.14 is released we might be able to use
Fluent::Parser::TimeParser, but it doesn't quite do what we want - if gives
[sec,nsec] where as we want something we can call `strftime` on
once fluent v0 . 14 is released we might be able to use Fluent :: Parser :: TimeParser but it doesn ' t quite do what we want - if gives [ sec nsec ] where as we want something we can call ` strftime ` on
def create_time_parser
      if @time_key_format
        begin
          strptime = Strptime.new(@time_key_format)
          Proc.new { |value| strptime.exec(value).to_datetime }
        rescue
          Proc.new { |value| DateTime.strptime(value, @time_key_format) }
        end
      else
        Proc.new { |value| DateTime.parse(value) }
      end
    end
def create_time_parser if @time_key_format begin strptime = Strptime . new ( @time_key_format ) Proc . new { | value | strptime . exec ( value ) . to_datetime } rescue Proc . new { | value | DateTime . strptime ( value , @time_key_format ) } end else Proc . new { | value | DateTime . parse ( value ) } end end
once fluent v0.14 is released we might be able to use
Fluent::Parser::TimeParser, but it doesn't quite do what we want - if gives
[sec,nsec] where as we want something we can call `strftime` on...
once fluent v0 . 14 is released we might be able to use Fluent :: Parser :: TimeParser but it doesn ' t quite do what we want - if gives [ sec nsec ] where as we want something we can call ` strftime ` on ...
# Strptime doesn't support all formats, but for those it does it's # blazingly fast. # Can happen if Strptime doesn't recognize the format; or # if strptime couldn't be required (because it's not installed -- it's # ruby 2 only)