Class: Fluent::Plugin::NetflowipfixInput

Inherits:
Input
  • Object
show all
Defined in:
lib/fluent/plugin/in_netflowipfix.rb,
lib/fluent/plugin/parser_netflow_v5.rb,
lib/fluent/plugin/parser_netflow_v9.rb,
lib/fluent/plugin/netflowipfix_records.rb

Defined Under Namespace

Classes: Header, IP4Addr, IP6Addr, MacAddr, MplsLabel, Netflow10Packet, Netflow5Packet, Netflow9Packet, OctetArray1, OctetArray2, Option10, Option9, ParserIPfixv10, ParserNetflowBase, ParserNetflowIpfix, ParserNetflowv5, ParserNetflowv9, Template10, Template9

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object

config_param :protocol_type



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

def configure(conf)
	super
	@nbpackets = 0
	@parser_v5 = ParserNetflowv5.new
	@parser_v9 = ParserNetflowv9.new
	@parser_v9.configure(@cache_ttl, @definitions)
	@parser_v10 = ParserIPfixv10.new
	@parser_v10.configure(@cache_ttl, @definitions)
end

#runObject

def shutdown



70
71
72
73
74
75
# File 'lib/fluent/plugin/in_netflowipfix.rb', line 70

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

#shutdownObject

def start



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

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

#startObject

def configure



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

def start
	@loop = Coolio::Loop.new
	@handler = listen(method(:receive_data))
	@loop.attach(@handler)
	@thread = Thread.new(&method(:run))
end