lib/fluent/plugin/in_watch_process.rb in fluent-plugin-watch-process-0.0.3 vs lib/fluent/plugin/in_watch_process.rb in fluent-plugin-watch-process-0.1.0

- old
+ new

@@ -1,5 +1,6 @@ +require "fluent/input" require 'fluent/mixin/rewrite_tag_name' require 'fluent/mixin/type_converter' module Fluent class WatchProcessInput < Fluent::Input @@ -14,17 +15,13 @@ DEFAULT_KEYS = %w(start_time user pid parent_pid cpu_time cpu_percent memory_percent mem_rss mem_size state proc_name command) DEFAULT_TYPES = "pid:integer,parent_pid:integer,cpu_percent:float,memory_percent:float,mem_rss:integer,mem_size:integer" include Fluent::HandleTagNameMixin - include Fluent::Mixin::RewriteTagName - config_set_default :enable_placeholder_upcase, true - config_set_default :enable_placeholder_hostname, true - include Fluent::Mixin::TypeConverter - config_param :types, :string, :default => DEFAULT_TYPES + config_set_default :types, DEFAULT_TYPES def initialize super require 'time' end @@ -62,10 +59,10 @@ data = Hash[@keys.zip(values.reject(&:empty?).flatten)] data['elapsed_time'] = (Time.now - Time.parse(data['start_time'])).to_i if data['start_time'] next unless @lookup_user.nil? || @lookup_user.include?(data['user']) emit_tag = tag.dup filter_record(emit_tag, Engine.now, data) - Engine.emit(emit_tag, Engine.now, data) + router.emit(emit_tag, Engine.now, data) end io.close sleep @interval end rescue StandardError => e