Sha256: 15884ae8829d287d87008f5afcd0f04f31ca79c5f5f685681b9d97b8561dc7bb
Contents?: true
Size: 631 Bytes
Versions: 3
Compression:
Stored size: 631 Bytes
Contents
# frozen_string_literal: true require 'json' require 'time' require 'date' module LogStasher class Event def initialize(data = {}) @cancelled = false @data = data if data.include?('@timestamp') t = data['@timestamp'] data['@timestamp'] = Time.parse(t).gmtime.iso8601(3) if t.is_a?(String) else data['@timestamp'] = ::Time.now.utc.iso8601(3) end data['@version'] = '1' unless @data.include?('@version') end def to_s to_json.to_s end def to_json(*args) @data.to_json(*args) end def [](key) @data[key] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
logstasher-2.1.5 | lib/logstasher/event.rb |
logstasher-2.1.3 | lib/logstasher/event.rb |
logstasher-2.1.2 | lib/logstasher/event.rb |