Sha256: 3fe7f1540011e53ca56c07dad71eed44b0f7a61bdbfafd812b0b1fd6a285546b
Contents?: true
Size: 761 Bytes
Versions: 1
Compression:
Stored size: 761 Bytes
Contents
module Anschel class Filter def index conf stamp = conf.delete(:stamp) || '@timestamp' prefix = conf.delete(:prefix) || 'logs-%{type}-' suffix = conf.delete(:suffix) || '%Y.%m.%d' stamp = stamp.to_sym iso8601 = "yyyy-MM-dd'T'HH:mm:ss.SSSZ" joda = org.joda.time.format.DateTimeFormat.forPattern iso8601 joda = joda.withDefaultYear(Time.new.year) joda = joda.withOffsetParsed lambda do |event| return event unless event.has_key? stamp millis = joda.parseMillis event[stamp] idx_prefix = prefix % event idx_suffix = Time.at(0.001 * millis).strftime(suffix) event[:_index] = idx_prefix + idx_suffix filtered event, conf end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
anschel-0.1.0 | lib/anschel/filter/index.rb |