Class: Fluent::Plugin::NetflowipfixInput::ParserNetflowv9

Inherits:
ParserNetflowIpfix show all
Defined in:
lib/fluent/plugin/parser_netflow_v9.rb

Instance Method Summary collapse

Instance Method Details

#configure(cache_ttl, definitions) ⇒ Object



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/fluent/plugin/parser_netflow_v9.rb', line 264

def configure(cache_ttl, definitions)
	super(cache_ttl, definitions)
	@templates9 = Vash.new()
	@samplers_v9 = Vash.new()
	# Path to default Netflow v9 field definitions
	filename9 = File.expand_path('../netflow_fields.yaml', __FILE__)

	begin
	  @fields9 = YAML.load_file(filename9)
	rescue => e
	  raise ConfigError, "Bad syntax in definitions file #{filename9}, error_class = #{e.class.name}, error = #{e.message}"
	end
   
	# Allow the user to augment/override/rename the supported Netflow fields
	if @definitions
	  raise ConfigError, "definitions file #{@definitions} doesn't exist" unless File.exist?(@definitions)
	  begin
		@fields9['option'].merge!(YAML.load_file(@definitions))
	  rescue => e
		raise ConfigError, "Bad syntax in definitions file #{@definitions}, error_class = #{e.class.name}, error = #{e.message}"
	  end
	end
end

#handle_v9(host, pdu, block) ⇒ Object

def configure



288
289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/fluent/plugin/parser_netflow_v9.rb', line 288

def handle_v9(host, pdu, block)
	pdu.records.each do |flowset|
	  case flowset.flowset_id
	  when 0
		handle_flowset_template(host, pdu, flowset, @templates9, @fields9)
	  when 1
		handle_flowset_options_template(host, pdu, flowset, @templates9, @fields9)
	  when 256..65535
		handle_flowset_data(host, pdu, flowset, block, @templates9, @fields9, 9)
	  else
		$log.warn 'v9 Unsupported flowset', flowset_id: flowset.flowset_id
	  end # case 
	end # do
end