fluent-plugin-netflow 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f725de99f7376988cbe9b19590d6174bea6cd65
4
- data.tar.gz: bb36543ed91ab717ce298e0f8b5b6d9cab08e59c
3
+ metadata.gz: 6e2cf6e2ee13f2228e628ef23638219326b235a4
4
+ data.tar.gz: 96b90f05451f8adee07596457637779d8236e9e1
5
5
  SHA512:
6
- metadata.gz: 60692620391561a0906d29c896ecfe7ef8b6da97df630bfed69a0f32104d373450dd610e23d0469742a0be821b39f9923c9eff6dbfc29cc567dbf053c25754d1
7
- data.tar.gz: 8fa9ab2a6d483e08382b499cbbf7b6e52ba8b4fc19ed9fa2cfbe94088c94dcf79e6e04fc56062dd78e6327d253c477f89f030dbb9c09ac12348f0a204ce6d484
6
+ metadata.gz: b445f204e476373bf96f5c9acd56eabf11298f7cfcaae1c6686e848e7648b909fbcbed57834578997fb468595b6f44c55c9ab6fb2e66a06f8313b405c20c320e
7
+ data.tar.gz: 36e57848e318f596bb964861310b258820e4963982c8a3ca558049d5ab567d9d5ae1605b4dee65ed44e40bbdc3adf157b96a30ff88dd9e3de5ed7e4ec8e8ffec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -70,7 +70,7 @@ module Fluent
70
70
  protected
71
71
 
72
72
  def receive_data(host, data)
73
- log.debug "received logs", :host => host, :data => data
73
+ log.on_debug { log.debug "received logs", :host => host, :data => data }
74
74
 
75
75
  @parser.call(data) { |time, record|
76
76
  unless time && record
@@ -89,7 +89,7 @@ module Fluent
89
89
  private
90
90
 
91
91
  def listen(callback)
92
- log.debug "listening netflow socket on #{@bind}:#{@port} with #{@protocol_type}"
92
+ log.info "listening netflow socket on #{@bind}:#{@port} with #{@protocol_type}"
93
93
  if @protocol_type == :udp
94
94
  @usock = SocketUtil.create_udp_socket(@bind)
95
95
  @usock.bind(@bind, @port)
@@ -90,7 +90,7 @@
90
90
  - :uint8
91
91
  - :ipv6_dst_mask
92
92
  31:
93
- - :uint24
93
+ - 3
94
94
  - :ipv6_flow_label
95
95
  32:
96
96
  - :uint16
@@ -140,7 +140,7 @@
140
140
  - :uint32
141
141
  - :mpls_top_label_ip_addr
142
142
  48:
143
- - 4
143
+ - 1
144
144
  - :flow_sampler_id
145
145
  49:
146
146
  - :uint8
@@ -189,8 +189,6 @@
189
189
  64:
190
190
  - :uint32
191
191
  - :ipv6_option_headers
192
- 64:
193
- - :skip
194
192
  65:
195
193
  - :skip
196
194
  66:
@@ -222,6 +220,18 @@
222
220
  83:
223
221
  - :string
224
222
  - :if_desc
223
+ 84:
224
+ - :string
225
+ - :sampler_name
225
226
  89:
226
227
  - :uint8
227
228
  - :forwarding_status
229
+ 91:
230
+ - :uint8
231
+ - :mpls_prefix_len
232
+ 234:
233
+ - :uint32
234
+ - :ingress_vrf_id
235
+ 235:
236
+ - :uint32
237
+ - :egress_vrf_id
@@ -0,0 +1,16 @@
1
+ ---
2
+ 1:
3
+ - :ip4_addr
4
+ - :system
5
+ 2:
6
+ - :skip
7
+ - :interface
8
+ 3:
9
+ - :skip
10
+ - :line_card
11
+ 4:
12
+ - :skip
13
+ - :netflow_cache
14
+ 5:
15
+ - :skip
16
+ - :template
@@ -25,7 +25,7 @@ module Fluent
25
25
 
26
26
  @templates = Vash.new()
27
27
  # Path to default Netflow v9 field definitions
28
- filename = File.expand_path('../netflow.yaml', __FILE__)
28
+ filename = File.expand_path('../netflow_option_fields.yaml', __FILE__)
29
29
 
30
30
  begin
31
31
  @fields = YAML.load_file(filename)
@@ -42,6 +42,14 @@ module Fluent
42
42
  raise "Bad syntax in definitions file #{@definitions}"
43
43
  end
44
44
  end
45
+ # Path to default Netflow v9 scope field definitions
46
+ filename = File.expand_path('../netflow_scope_fields.yaml', __FILE__)
47
+
48
+ begin
49
+ @scope_fields = YAML.load_file(filename)
50
+ rescue Exception => e
51
+ raise "Bad syntax in scope definitions file #{filename}"
52
+ end
45
53
  end
46
54
 
47
55
  def call(payload)
@@ -107,7 +115,7 @@ module Fluent
107
115
  catch (:field) do
108
116
  fields = []
109
117
  template.fields.each do |field|
110
- entry = netflow_field_for(field.field_type, field.field_length)
118
+ entry = netflow_field_for(field.field_type, field.field_length, @fields)
111
119
  if !entry
112
120
  throw :field
113
121
  end
@@ -126,8 +134,15 @@ module Fluent
126
134
  record.flowset_data.templates.each do |template|
127
135
  catch (:field) do
128
136
  fields = []
137
+ template.scope_fields.each do |field|
138
+ entry = netflow_field_for(field.field_type, field.field_length, @scope_fields)
139
+ if ! entry
140
+ throw :field
141
+ end
142
+ fields += entry
143
+ end
129
144
  template.option_fields.each do |field|
130
- entry = netflow_field_for(field.field_type, field.field_length)
145
+ entry = netflow_field_for(field.field_type, field.field_length, @fields)
131
146
  if ! entry
132
147
  throw :field
133
148
  end
@@ -204,9 +219,9 @@ module Fluent
204
219
  ("uint" + (((length > 0) ? length : default) * 8).to_s).to_sym
205
220
  end
206
221
 
207
- def netflow_field_for(type, length)
208
- if @fields.include?(type)
209
- field = @fields[type]
222
+ def netflow_field_for(type, length, field_definitions)
223
+ if field_definitions.include?(type)
224
+ field = field_definitions[type]
210
225
  if field.is_a?(Array)
211
226
 
212
227
  if field[0].is_a?(Integer)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-netflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Nakagawa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-28 00:00:00.000000000 Z
11
+ date: 2015-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -71,7 +71,8 @@ files:
71
71
  - VERSION
72
72
  - fluent-plugin-netflow.gemspec
73
73
  - lib/fluent/plugin/in_netflow.rb
74
- - lib/fluent/plugin/netflow.yaml
74
+ - lib/fluent/plugin/netflow_option_fields.yaml
75
+ - lib/fluent/plugin/netflow_scope_fields.yaml
75
76
  - lib/fluent/plugin/parser_netflow.rb
76
77
  homepage: https://github.com/repeatedly/fluent-plugin-netflow
77
78
  licenses:
@@ -93,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
94
  version: '0'
94
95
  requirements: []
95
96
  rubyforge_project:
96
- rubygems_version: 2.2.3
97
+ rubygems_version: 2.2.2
97
98
  signing_key:
98
99
  specification_version: 4
99
100
  summary: Netflow plugin for Fluentd