fluent-plugin-netflowipfix 1.2.1 → 1.3.0
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 +4 -4
- data/fluent-plugin-netflowipfix.gemspec +1 -1
- data/lib/fluent/plugin/in_netflowipfix.rb +66 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffd080d6da500d91c9bfcbc9a815985903a83f1b
|
4
|
+
data.tar.gz: b87b67b5914daafa712349959698de3aa24f9ae9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 616a1d280a876a17a08ea30e653087af377812ef9ea1192a7751a1136c17050c34f0f9704df4b3cec7ee7ef54c1cd5b0c2f9a4693e678bd966559523da8f0db7
|
7
|
+
data.tar.gz: 8bc83701ca3391b8b24ddd4b40d4b0f8d6ae1c2732be310b64b0344b004a82e2fdc85014e95c9cb0e756789007093199e3f33674de896578cde67636936b5144
|
@@ -65,6 +65,16 @@ class PortConnection
|
|
65
65
|
@thread_parser.join
|
66
66
|
end # def stop
|
67
67
|
|
68
|
+
def restartParser
|
69
|
+
if !@thread_parser.nil?
|
70
|
+
@thread_parser.close
|
71
|
+
@thread_parser.join
|
72
|
+
@thread_parser = nil
|
73
|
+
end
|
74
|
+
@thread_parser = ParserThread.new(@udpQueue, @queuesleep, @eventQueue, @cache_ttl, @definitions, @log)
|
75
|
+
@thread_parser.start
|
76
|
+
end
|
77
|
+
|
68
78
|
def event_pop
|
69
79
|
@eventQueue.pop
|
70
80
|
end
|
@@ -120,9 +130,21 @@ end #class PortConnection
|
|
120
130
|
end
|
121
131
|
|
122
132
|
end
|
123
|
-
|
133
|
+
|
134
|
+
def restartConnections
|
135
|
+
@@connections.each do | port, conn |
|
136
|
+
$log.debug "restart parser #{conn.bind}:#{conn.port}"
|
137
|
+
conn.restartParser
|
138
|
+
end
|
139
|
+
before = GC.stat(:total_freed_objects)
|
140
|
+
GC.start
|
141
|
+
after = GC.stat(:total_freed_objects)
|
142
|
+
|
143
|
+
end
|
124
144
|
|
125
145
|
def waitForEvents
|
146
|
+
timeStart = Time.now.getutc.to_i
|
147
|
+
nb = 0
|
126
148
|
loop do
|
127
149
|
@@connections.each do | port, conn |
|
128
150
|
if (conn.event_queue_length > 0)
|
@@ -133,12 +155,31 @@ end #class PortConnection
|
|
133
155
|
time = ar[0]
|
134
156
|
record = ar[1]
|
135
157
|
router.emit(conn.tag, EventTime.new(time.to_i), record)
|
158
|
+
# Free up variables for garbage collection
|
159
|
+
ar = nil
|
160
|
+
time = nil
|
161
|
+
record = nil
|
162
|
+
nb = nb + 1
|
136
163
|
nbq = nbq - 1
|
137
164
|
break if nbq == 0
|
138
165
|
end
|
139
166
|
end
|
140
167
|
end
|
141
|
-
|
168
|
+
# @log.trace "NetflowipfixInput::waitForEvents ObjectSpace.memsize_of(NetflowipfixInput)=#{ObjectSpace.memsize_of(self)}"
|
169
|
+
if Time.now.getutc.to_i - timeStart > 600 # 300 = 5 min
|
170
|
+
restartConnections
|
171
|
+
timeStart = Time.now.getutc.to_i
|
172
|
+
end
|
173
|
+
|
174
|
+
# Garbage collection
|
175
|
+
if nb >= 20
|
176
|
+
nb = 0
|
177
|
+
# debugSpace
|
178
|
+
end
|
179
|
+
before = GC.stat(:total_freed_objects)
|
180
|
+
GC.start
|
181
|
+
after = GC.stat(:total_freed_objects)
|
182
|
+
# $log.trace "waitForEvents: sleep #{@queuesleep}"
|
142
183
|
sleep(@queuesleep)
|
143
184
|
|
144
185
|
end
|
@@ -175,6 +216,7 @@ class UdpListenerThread
|
|
175
216
|
|
176
217
|
|
177
218
|
def run
|
219
|
+
nb = 0
|
178
220
|
loop do
|
179
221
|
msg, sender = @udp_socket.recvfrom(4096)
|
180
222
|
@total = @total + msg.length
|
@@ -188,6 +230,15 @@ class UdpListenerThread
|
|
188
230
|
# time = EventTime.new()
|
189
231
|
time = Time.now.getutc
|
190
232
|
@udpQueue << [time, record]
|
233
|
+
# Garbage collection
|
234
|
+
msg = nil
|
235
|
+
sender = nil
|
236
|
+
nb = nb + 1
|
237
|
+
if nb > 100
|
238
|
+
GC.start
|
239
|
+
nb = 0
|
240
|
+
end
|
241
|
+
|
191
242
|
end
|
192
243
|
end
|
193
244
|
end # class UdpListenerThread
|
@@ -212,6 +263,11 @@ class ParserThread
|
|
212
263
|
end
|
213
264
|
|
214
265
|
def close
|
266
|
+
# Garbage collection
|
267
|
+
@parser_v5 = nil
|
268
|
+
@parser_v9 = nil
|
269
|
+
@parser_v10 = nil
|
270
|
+
GC.start
|
215
271
|
end
|
216
272
|
|
217
273
|
def join
|
@@ -248,6 +304,14 @@ class ParserThread
|
|
248
304
|
$log.warn "Unsupported Netflow version v#{version}: #{version.class}"
|
249
305
|
end # case
|
250
306
|
|
307
|
+
# Free up variables for garbage collection
|
308
|
+
ar = @udpQueue.pop
|
309
|
+
version = nil
|
310
|
+
time = nil
|
311
|
+
msg = nil
|
312
|
+
payload = nil
|
313
|
+
host = nil
|
314
|
+
|
251
315
|
end
|
252
316
|
end # loop do
|
253
317
|
end # def run
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-netflowipfix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yves Desharnaus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|