Sha256: cd3c315171d20679f22699a718df1f052323098cf1cd496fdb35bae14d0f703f
Contents?: true
Size: 722 Bytes
Versions: 1
Compression:
Stored size: 722 Bytes
Contents
require "logstash/codecs/base" require "logstash/codecs/line" class LogStash::Codecs::EDNLines < LogStash::Codecs::Base config_name "edn_lines" milestone 1 def register require "edn" end public def initialize(params={}) super(params) @lines = LogStash::Codecs::Line.new end public def decode(data) @lines.decode(data) do |event| begin yield LogStash::Event.new(EDN.read(event["message"])) rescue => e @logger.info("EDN parse failure. Falling back to plain-text", :error => e, :data => data) yield LogStash::Event.new("message" => data) end end end public def encode(data) @on_event.call(data.to_hash.to_edn + "\n") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logstash-lib-1.3.2 | lib/logstash/codecs/edn_lines.rb |