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



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

def configure(conf)
  super

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

#runObject



63
64
65
66
67
68
# File 'lib/fluent/plugin/in_netflow.rb', line 63

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

#shutdownObject



55
56
57
58
59
60
61
# File 'lib/fluent/plugin/in_netflow.rb', line 55

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

#startObject



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

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

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