Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sampling to netflow and sflow #290

Merged
merged 5 commits into from
Jun 30, 2021
Merged

Add sampling to netflow and sflow #290

merged 5 commits into from
Jun 30, 2021

Conversation

jsirianni
Copy link
Member

We want to give the user the option of filtering / sampling their netflow / sflow logs. The data can be redundant, therefore it is not necessary to handle every entry.

Default behavior excludes sampling. When enabled, the user has their choice of 0-100% in 10% increments. A sample rate of 0% will filter nothing, and a sample rate of 90% will filter most entries.

In testing, a sample rate of 0.5 produced has as many logs, while a sample rate of 0.0 produced 100% of logs. Testing for short durations is hit and miss but 3 minutes or longer has nice results.

You can test netflow v5 like this
config.yaml (without sample rate)

pipeline:
- type: netflow
  netflow_version: v5
  listen_address: 0.0.0.0:2056
- type: stdout
wc out, 528, 30 seconds
wc out, 4648, 3 minutes

config.yaml (with sample rate)

pipeline:
- type: netflow
  netflow_version: v5
  listen_address: 0.0.0.0:2056
  sampling_enable: true
  sampling_drop_rate: "0.5"
- type: file_output
  path: out.sampled
wc out.sampled, 418, 30 seconds
wc out.sampled, 2163, 3 minutes

Start Stanza

./stanza -c ./config.yaml --plugin_dir ./plugins

Run a loadgen container. 10.99.1.24 is my ip address, you need to determine your ip address. I believe it will not work with localhost / 127.0.0.1

docker run -it --rm networkstatic/nflow-generator -t 10.99.1.23 -p 2056

Copy link
Contributor

@BinaryFissionGames BinaryFissionGames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments about some of the more meta-data related stuff!

plugins/netflow.yaml Outdated Show resolved Hide resolved
plugins/sflow.yaml Outdated Show resolved Hide resolved
plugins/netflow.yaml Outdated Show resolved Hide resolved
plugins/sflow.yaml Outdated Show resolved Hide resolved
Joseph Sirianni and others added 2 commits June 30, 2021 10:51
Co-authored-by: Brandon Johnson <[email protected]>
Co-authored-by: Brandon Johnson <[email protected]>
@jsirianni jsirianni merged commit 330fce6 into master Jun 30, 2021
@jsirianni jsirianni deleted the goflow-filter branch June 30, 2021 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants