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

Customize amount of Netflow aggregator history kept #6085

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

n-thumann
Copy link
Contributor

This PR introduces the ability for a user to customize the amount of history that is kept by the Netflow aggregator instead of using hardcoded values. For the source address details there's always 62 days of history kept, even though a user might want to keep more / less.

Why is this needed?
I regularly ran into the same issue as #4831, https://forum.opnsense.org/index.php?topic=30071.msg145214 or https://forum.opnsense.org/index.php?topic=20489.msg95251. In these cases the SQLite DBs of the aggregator take up a lot of space and cause the vacuum to fail.

I therefore moved the hardcoded values to a config file, which is written by configd. I kept the old history values as defaults. The newly added fields can be access via Reporting -> Netflow after enabling the advanced settings.

@AdSchellevis AdSchellevis self-assigned this Oct 14, 2022
@AdSchellevis
Copy link
Member

I'll try to take a look, but at a first glance I would rather try to focus on less toggles facing the user.

@n-thumann
Copy link
Contributor Author

focus on less toggles facing the user

Yeah, i was thinking about this as well, but am struggling to come up with a good idea. Any ideas and how to incorporate them in the UI?

@AdSchellevis
Copy link
Member

I'm not sure yet either to be honest, we could try to focus on the most problematic files in size first and uniform it a bit, the more aggregated ones are likely less problematic. How large are the files on your installation?

@n-thumann
Copy link
Contributor Author

root@OPNsense:~ # ls -lh /var/netflow/
total 8889260
-rw-r-----  1 root  wheel   1.9M Oct  7 01:17 dst_port_000300.sqlite
-rw-r-----  1 root  wheel    21M Oct  7 01:17 dst_port_003600.sqlite
-rw-r-----  1 root  wheel   419M Oct  7 01:17 dst_port_086400.sqlite
-rw-r-----  1 root  wheel   2.3M Oct  7 01:17 interface_000030.sqlite
-rw-r-----  1 root  wheel   1.5M Oct  7 01:17 interface_000300.sqlite
-rw-r-----  1 root  wheel   216K Oct  7 01:17 interface_003600.sqlite
-rw-r-----  1 root  wheel   200K Oct  7 01:17 interface_086400.sqlite
-rw-r-----  1 root  wheel    12K Oct  7 01:17 metadata.sqlite
-rw-r-----  1 root  wheel   8.0M Oct  7 01:17 src_addr_000300.sqlite
-rw-r-----  1 root  wheel    85M Oct  7 01:17 src_addr_003600.sqlite
-rw-r-----  1 root  wheel   3.1G Oct  7 01:17 src_addr_086400.sqlite
-rw-r-----  1 root  wheel   4.9G Oct  7 01:20 src_addr_details_086400.sqlite

src_addr_details_086400.sqlite being the largest aligns with what other people reported (see links above).

Or would it be an option to move Capture local and my newly added fields to a new tab called Collect? While this wouldn't solve the issue of too many fields facing the user, it'd at least spreads the problem to another page.

@AdSchellevis
Copy link
Member

Maybe it's enough to just offer the maximum numbers of days to keep given the daily summary sizes are the problematic ones.

If we choose to configure the src_addr_details_086400.sqlite to a relative number, we only need a single setting (1/6 th of specified days for example).

@n-thumann
Copy link
Contributor Author

n-thumann commented Oct 23, 2022

Good point! Based on this, we could only add one field for each resolution available (i.e. 30, 300, ...), instead of adding one for each aggregator. This would reduce the number of fields added from eleven down to four.
But only having a single setting per resolution (or only one at all, if we only want the 86400 sec. resolution) has one big issue:

  • interface, port and source keep 365 days per default
  • source details keeps 61 days per default

If we'd join their history setting, we would either truncate a lot of history (by using 61 days for all) or make the problem even worst (by using 365 days for all) :/

@AdSchellevis
Copy link
Member

I was more thinking in the direction of configuring the max and stick source details to a relative factor e.g 1/6 x configured would be roughly the same as it is now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants