Class: LogStash::Codecs::EDN
- Defined in:
- lib/logstash/codecs/edn.rb
Constant Summary
Constants included from LogStash::Config::Mixin
LogStash::Config::Mixin::CONFIGSORT
Instance Attribute Summary
Attributes included from LogStash::Config::Mixin
Attributes inherited from Plugin
Instance Method Summary collapse
Methods inherited from Base
#clone, #flush, #initialize, #on_event, #teardown
Methods included from LogStash::Config::Mixin
Methods inherited from Plugin
#eql?, #finished, #finished?, #hash, #initialize, #inspect, lookup, #reload, #running?, #shutdown, #teardown, #terminating?, #to_s
Constructor Details
This class inherits a constructor from LogStash::Codecs::Base
Instance Method Details
#decode(data) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/logstash/codecs/edn.rb', line 14 def decode(data) begin yield LogStash::Event.new(EDN.read(data)) rescue @logger.info("EDN parse failure. Falling back to plain-text", :error => e, :data => data) yield LogStash::Event.new("message" => data) end end |
#encode(data) ⇒ Object
24 25 26 |
# File 'lib/logstash/codecs/edn.rb', line 24 def encode(data) @on_event.call(data.to_hash.to_edn) end |
#register ⇒ Object
9 10 11 |
# File 'lib/logstash/codecs/edn.rb', line 9 def register require "edn" end |