[management] Add an environment variable to disable peer session events

Closed
ML
1d ago
+98-7

Describe your changes

Peer session events add one audit entry per connect and disconnect, which can be a lot of volume on large or unstable deployments. Today the only way to avoid them is NB_EVENT_ACTIVITY_LOG_ENABLED=false, which turns off the whole activity log.

NB_DISABLE_PEER_SESSION_EVENTS=true turns off only peer.connect and peer.disconnect. It is read once when the account manager is built and parsed with strconv.ParseBool; an invalid value logs a warning and leaves the events on. Connection state writes and all other activity events are unaffected.

Stacked on netbirdio/netbird#8620.

Issue ticket number and link

https://github.com/netbirdio/netbird/issues/8616

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • I ran and tested this change locally — I did not rely on CI to find out whether it works
  • This PR has a single purpose (not a fix + refactor + feature in one)
  • This change is a trivial fix, OR it links an issue the NetBird team agreed on beforehand. Changes to the public API, gRPC protocols, functionality behavior, CLI / service flags, or new features always need that agreement first. See CONTRIBUTING.md.

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/1118