Class: Fluent::Plugin::StdoutFilter

Inherits:
Filter show all
Defined in:
lib/fluent/plugin/filter_stdout.rb

Constant Summary collapse

DEFAULT_FORMAT_TYPE =
'stdout'

Constants included from Configurable

Configurable::CONFIG_TYPE_REGISTRY

Instance Attribute Summary collapse

Attributes inherited from Filter

#has_filter_with_time

Attributes included from Fluent::PluginLoggerMixin

#log

Attributes inherited from Base

#under_plugin_development

Instance Method Summary collapse

Methods inherited from Filter

#emit_records, #emit_size, #filter, #filter_with_time, #initialize, #measure_metrics, #statistics

Methods included from Fluent::PluginHelper::Mixin

included

Methods included from Fluent::PluginLoggerMixin

included, #initialize, #terminate

Methods included from Fluent::PluginId

#initialize, #plugin_id, #plugin_id_configured?, #plugin_id_for_test?, #plugin_root_dir, #stop

Methods inherited from Base

#acquire_worker_lock, #after_shutdown, #after_shutdown?, #after_start, #after_started?, #before_shutdown, #before_shutdown?, #called_in_test?, #close, #closed?, #configured?, #context_router, #context_router=, #fluentd_worker_id, #get_lock_path, #has_router?, #initialize, #inspect, #multi_workers_ready?, #plugin_root_dir, #reloadable_plugin?, #shutdown, #shutdown?, #start, #started?, #stop, #stopped?, #string_safe_encoding, #terminate, #terminated?

Methods included from SystemConfig::Mixin

#system_config, #system_config_override

Methods included from Configurable

#config, #configure_proxy_generate, #configured_section_create, included, #initialize, lookup_type, register_type

Constructor Details

This class inherits a constructor from Fluent::Plugin::Filter

Instance Attribute Details

#formatterObject (readonly)

for tests



32
33
34
# File 'lib/fluent/plugin/filter_stdout.rb', line 32

def formatter
  @formatter
end

Instance Method Details

#configure(conf) ⇒ Object



34
35
36
37
38
# File 'lib/fluent/plugin/filter_stdout.rb', line 34

def configure(conf)
  compat_parameters_convert(conf, :inject, :formatter)
  super
  @formatter = formatter_create
end

#filter_stream(tag, es) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/fluent/plugin/filter_stdout.rb', line 40

def filter_stream(tag, es)
  es.each { |time, record|
    begin
      r = inject_values_to_record(tag, time, record)
      log.write @formatter.format(tag, time, r)
    rescue => e
      router.emit_error_event(tag, time, record, e)
    end
  }
  log.flush
  es
end