Class: Fluent::Plugin::NetflowipfixInput::ParserIPfixv10

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

Overview

class ParserNetflowv9

Instance Method Summary collapse

Instance Method Details

#configure(cache_ttl, definitions) ⇒ Object



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# File 'lib/fluent/plugin/parser_netflow_v9.rb', line 307

def configure(cache_ttl, definitions)
  super(cache_ttl, definitions)
  @templates10 = Vash.new()
  @samplers_v10 = Vash.new()
 
# Path to default Netflow v10 field definitions
  filename10 = File.expand_path('../ipfix_fields.yaml', __FILE__)

  begin
    @fields10 = YAML.load_file(filename10)
  rescue => e
    raise ConfigError, "Bad syntax in definitions file #{filename10}, 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
    @fields10['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_v10(host, pdu, block) ⇒ Object

def configure



332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/fluent/plugin/parser_netflow_v9.rb', line 332

def handle_v10(host, pdu, block)
          pdu.records.each do |flowset|
 case flowset.flowset_id
 when 2
handle_flowset_template(host, pdu, flowset, @templates10, @fields10)
 when 3
handle_flowset_options_template(host, pdu, flowset, @templates10, @fields10)
 when 256..65535
handle_flowset_data(host, pdu, flowset, block, @templates10, @fields10, 10)
 else
$log.warn 'v10 Unsupported set', set_id: flowset.set_id
 end # case
          end # do
end