Class: Fluent::Plugin::UdpInput
- Defined in:
- lib/fluent/plugin/in_udp.rb
Constant Summary
Constants included from Configurable
Configurable::CONFIG_TYPE_REGISTRY
Instance Attribute Summary
Attributes included from Fluent::PluginLoggerMixin
Attributes inherited from Base
Instance Method Summary collapse
Methods included from Fluent::PluginHelper::Mixin
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
Methods inherited from Base
#after_shutdown, #after_shutdown?, #after_start, #after_started?, #before_shutdown, #before_shutdown?, #close, #closed?, #configured?, #context_router, #context_router=, #fluentd_worker_id, #has_router?, #initialize, #inspect, #plugin_root_dir, #shutdown, #shutdown?, #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
Instance Method Details
#configure(conf) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/fluent/plugin/in_udp.rb', line 44 def configure(conf) compat_parameters_convert(conf, :parser) super @_event_loop_blocking_timeout = @blocking_timeout @source_hostname_key ||= @source_host_key if @source_host_key @message_length_limit = @body_size_limit if @body_size_limit @parser = parser_create end |
#multi_workers_ready? ⇒ Boolean
54 55 56 |
# File 'lib/fluent/plugin/in_udp.rb', line 54 def multi_workers_ready? true end |
#start ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/fluent/plugin/in_udp.rb', line 58 def start super log.info "listening udp socket", bind: @bind, port: @port server_create(:in_udp_server, @port, proto: :udp, bind: @bind, max_bytes: @message_length_limit) do |data, sock| data.chomp! begin @parser.parse(data) do |time, record| unless time && record log.warn "pattern not match", data: data next end tag = extract_tag_from_record(record) tag ||= @tag time ||= extract_time_from_record(record) || Fluent::EventTime.now record[@source_hostname_key] = sock.remote_host if @source_hostname_key router.emit(tag, time, record) end end end end |