Sha256: 4bc7dbfd51e9aa9a7c0d983c604153892654c07a258e4e9f2fcf1562aa26edb3
Contents?: true
Size: 769 Bytes
Versions: 3
Compression:
Stored size: 769 Bytes
Contents
# encoding: utf-8 require "logstash/codecs/base" class LogStash::Codecs::Spool < LogStash::Codecs::Base config_name 'spool' config :spool_size, :validate => :number, :default => 50 attr_reader :buffer public def decode(data) data.each do |event| yield event end end # def decode public def encode(event) @buffer ||= [] #buffer size is hard coded for now until a #better way to pass args into codecs is implemented if @buffer.length >= @spool_size @on_event.call @buffer @buffer = [] else @buffer << event end end # def encode public def teardown if !@buffer.nil? and @buffer.length > 0 @on_event.call @buffer end @buffer = [] end end # class LogStash::Codecs::Spool
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
logstash-codec-spool-0.1.5 | lib/logstash/codecs/spool.rb |
logstash-codec-spool-0.1.4 | lib/logstash/codecs/spool.rb |
logstash-codec-spool-0.1.3 | lib/logstash/codecs/spool.rb |