lib/fluent/plugin/out_datacounter.rb
# Store internal status into a storage
#
Store internal status into a storage
Store internal status into a storage
def save_status()
    begin
      @saved_at = Fluent::Engine.now
      @saved_duration = @saved_at - @last_checked
      patterns = @patterns.map{|idx, label, regexp|
        if regexp
          [idx, label, regexp.source]
        else
          [idx, label, regexp]
        end
      }
      value = {
        "counts"         => @counts,
        "saved_at"       => @saved_at,
        "saved_duration" => @saved_duration,
        "aggregate"      => @aggregate,
        "count_key"      => @count_key.to_s,
        "patterns"       => patterns,
      }
      @storage.put(:stored_value, value)
    rescue => e
      log.warn "Can't write store_storage", error: e
    end
  end
def save_status ( ) begin @saved_at = Fluent :: Engine . now @saved_duration = @saved_at - @last_checked patterns = @patterns . map { | idx , label , regexp | if regexp [ idx , label , regexp . source ] else [ idx , label , regexp ] end } value = { "counts" => @counts , "saved_at" => @saved_at , "saved_duration" => @saved_duration , "aggregate" => @aggregate , "count_key" => @count_key . to_s , "patterns" => patterns , } @storage . put ( :stored_value , value ) rescue => e log . warn "Can't write store_storage" , error : e end end
Store internal status into a storage
Store internal status into a storage