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

slice the middle of a flow #194

Open
Pzoom522 opened this issue Apr 11, 2024 · 1 comment
Open

slice the middle of a flow #194

Pzoom522 opened this issue Apr 11, 2024 · 1 comment

Comments

@Pzoom522
Copy link

Dear developers,

Thanks for releasing this beautiful project!

In the "NFPlugins Examples" section, an implementation of FlowSlicer is provided. However, besides sampling the [1st packet, N-th packet] of each flow, I also want to sample the [N-th packet, M-th packet] of each flow. Is it possible?

@Pzoom522 Pzoom522 changed the title FLOW SLICER that specifies a beginning slice the middle of a flow Apr 11, 2024
@abbbe
Copy link

abbbe commented May 18, 2024

I am not an nfstream expert, but here are my 2 cents ;)

In the "NFPlugins Examples" section,

I guess you refer to https://www.nfstream.org/docs/api#flow-slicer.

besides sampling the [1st packet, N-th packet]

What you call packet sampling is actually sampling of expired flows, which can only occur once per a lifetime of a flow I believe. So you probably cannot make streamer return a flow more than once.

If you want to sample packets, you can do so inside on_init() and on_update() methods. Just count the packets and only act (for instanced append to flow.udps.sample_packets) on packets in N-M range.

I think you need to be careful about flow expiration, to make sure you it does not expire too soon, otherwise you might sample another piece of the same flow.

Hope it helps.

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

No branches or pull requests

2 participants