Class: Fluent::NetflowInput
- Inherits:
-
Input
- Object
- Input
- Fluent::NetflowInput
- Defined in:
- lib/fluent/plugin/in_netflow.rb
Defined Under Namespace
Classes: UdpHandler
Instance Method Summary collapse
- #configure(conf) ⇒ Object
-
#initialize ⇒ NetflowInput
constructor
A new instance of NetflowInput.
- #run ⇒ Object
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize ⇒ NetflowInput
Returns a new instance of NetflowInput.
22 23 24 25 26 27 |
# File 'lib/fluent/plugin/in_netflow.rb', line 22 def initialize super require 'cool.io' require 'fluent/plugin/socket_util' require 'fluent/plugin/parser_netflow' end |
Instance Method Details
#configure(conf) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/fluent/plugin/in_netflow.rb', line 41 def configure(conf) super @parser = TextParser::NetflowParser.new @parser.configure(conf) end |
#run ⇒ Object
63 64 65 66 67 68 |
# File 'lib/fluent/plugin/in_netflow.rb', line 63 def run @loop.run rescue log.error "unexpected error", :error=>$!.to_s log.error_backtrace end |
#shutdown ⇒ Object
56 57 58 59 60 61 |
# File 'lib/fluent/plugin/in_netflow.rb', line 56 def shutdown @loop.watchers.each { |w| w.detach } @loop.stop @handler.close @thread.join end |
#start ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/fluent/plugin/in_netflow.rb', line 48 def start @loop = Coolio::Loop.new @handler = listen(method(:receive_data)) @loop.attach(@handler) @thread = Thread.new(&method(:run)) end |