class LogStasher::Event
Public Class Methods
new(data = {})
click to toggle source
# File lib/logstasher/event.rb, line 9 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
Public Instance Methods
[](key)
click to toggle source
# File lib/logstasher/event.rb, line 30 def [](key) @data[key] end
to_json(*args)
click to toggle source
# File lib/logstasher/event.rb, line 26 def to_json(*args) @data.to_json(*args) end
to_s()
click to toggle source
# File lib/logstasher/event.rb, line 22 def to_s to_json.to_s end