Security-Onion-Solutions / security-onion

Security Onion 16.04 - Linux distro for threat hunting, enterprise security monitoring, and log management
https://securityonion.net
3.07k stars 522 forks source link

sostat: fix Suricata AF_PACKET packet loss calculation #1774

Closed dougburks closed 4 years ago

dougburks commented 4 years ago

From https://suricata.readthedocs.io/en/suricata-4.1.8/performance/statistics.html#kernel-drops:

stats.log contains interesting information in the capture.kernel_packets and capture.kernel_drops. The meaning of them is different following the capture mode.

In AF_PACKET mode:

kernel_packets is the number of packets correctly sent to userspace
kernel_drops is the number of packets that have been discarded instead of being sent to userspace

In PF_RING mode:

kernel_packets is the total number of packets seen by pf_ring
kernel_drops is the number of packets that have been discarded instead of being sent to userspace

So the packet loss calculation should determine if we are using AF_PACKET or PF_RING and calculate accordingly.

dougburks commented 4 years ago

List of packages to be tested:

An overview of the testing process can be found in the comments below.

Please record all testing results via comments on this issue.

Thanks in advance for your time effort!

dougburks commented 4 years ago

How To Start Testing

dougburks commented 4 years ago
bryant-treacle commented 4 years ago

Tested Good!!

I was able to generate the below packet loss: Suricata Packet loss with AF_PACKET: 5.9% Suricata Packet loss with PF_RING: 10%

dougburks commented 4 years ago

Thanks @bryant-treacle !

dougburks commented 4 years ago

Published: https://blog.securityonion.net/2020/06/securityonion-sostat-20120722.html

j-bernal commented 4 years ago

Tested Good.

I ran through testing with 0% packet loss using AF_PACKET and PF_RING.