bitkeks / python-netflow-v9-softflowd

PyPI "netflow" package. NetFlow v9 parser, collector and analyzer implemented in Python 3. Developed and tested with softflowd
https://bitkeks.eu/blog/2016/08/collecting-netflow-v9-on-openwrt.html
MIT License
110 stars 56 forks source link

collection from softflow fails #6

Closed momo7 closed 4 years ago

momo7 commented 5 years ago

Hi,

after installing and running the collector, I get the following error:

Exception happened during processing of request from (, 55757) Traceback (most recent call last): File "/usr/lib/python3.5/socketserver.py", line 313, in _handle_request_noblock self.process_request(request, client_address) File "/usr/lib/python3.5/socketserver.py", line 341, in process_request self.finish_request(request, client_address) File "/usr/lib/python3.5/socketserver.py", line 354, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python3.5/socketserver.py", line 681, in init self.handle() File "main.py", line 72, in handle export = ExportPacket(data, self.TEMPLATES) File "/root/netflow/src/netflow/collector_v9.py", line 312, in init tfs = TemplateFlowSet(data[offset:]) File "/root/netflow/src/netflow/collector_v9.py", line 266, in init field_type, field_length = struct.unpack('!HH', data[offset:offset+4]) struct.error: unpack requires a bytes object of length 4

Any idea what could be the issue?

bitkeks commented 5 years ago

Hi, thanks for your report! The cause might be a wrongly formatted export packet. Could you give some more information what exporter you use?

If you wish to debug it yourself, you can capture your traffic with tcpdump -w <pcap-file> and read this capture with softflowd -r <pcap-file>. softflowd then generates TCP flow exports like it would in a live session. The export can then be sent to the collector.

bitkeks commented 4 years ago

Closing since this issue is nearly a year old.