Class: Fluent::NetflowInput

Inherits:
Input
  • Object
show all
Defined in:
lib/fluent/plugin/in_netflow.rb

Defined Under Namespace

Classes: UdpHandler

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



38
39
40
41
42
43
# File 'lib/fluent/plugin/in_netflow.rb', line 38

def configure(conf)
  super

  @parser = TextParser::NetflowParser.new
  @parser.configure(conf)
end

#runObject



60
61
62
63
64
65
# File 'lib/fluent/plugin/in_netflow.rb', line 60

def run
  @loop.run
rescue => e
  log.error "unexpected error", error_class: e.class, error: e.message
  log.error_backtrace
end

#shutdownObject



53
54
55
56
57
58
# File 'lib/fluent/plugin/in_netflow.rb', line 53

def shutdown
  @loop.watchers.each { |w| w.detach }
  @loop.stop
  @handler.close
  @thread.join
end

#startObject



45
46
47
48
49
50
51
# File 'lib/fluent/plugin/in_netflow.rb', line 45

def start
  @loop = Coolio::Loop.new
  @handler = listen(method(:receive_data))
  @loop.attach(@handler)

  @thread = Thread.new(&method(:run))
end