conntrack: summarize stale-entry cleanup logging to cut log noise - #622
Open
yash97 wants to merge 9 commits into
Open
conntrack: summarize stale-entry cleanup logging to cut log noise#622yash97 wants to merge 9 commits into
yash97 wants to merge 9 commits into
Conversation
The conntrack GC cleanup logged one info line per stale entry deleted, per cleanup cycle. On an idle 2-node IPv6 cluster this single line was ~98% of all agent log output (~180 lines every 5-min cycle even with no workload churn). Demote the per-entry 'Conntrack cleanup Delete' line to debug and emit a single per-cycle info summary with the deleted/tracked counts instead. Full per-entry detail remains available at --log-level=debug, so debuggability is preserved while default-verbosity volume drops sharply. Applies to both the IPv4 (CleanupConntrackMap) and IPv6 (Cleanupv6ConntrackMap) paths.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #622 +/- ##
==========================================
- Coverage 29.00% 28.96% -0.04%
==========================================
Files 27 27
Lines 3424 3428 +4
==========================================
Hits 993 993
- Misses 2330 2334 +4
Partials 101 101
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
govulncheck flagged GO-2026-5970 in golang.org/x/text@v0.37.0
(indirect). Bump to v0.39.0 (the fixed version); go mod tidy pulls the
compatible golang.org/x/{sys,net,mod,sync,term,tools} updates alongside.
govulncheck ./... now reports no vulnerabilities.
- Drop the '(per-entry detail at debug level)' suffix from the info summary line (both v4 and v6) - low value, standard pattern, and reads as if it were part of the conntrack data. - Capture trackedEntries before the loop in the IPv4 path, mirroring the IPv6 path. More readable and robust to future cache-reset changes (the IPv4 summary previously relied on the cache reset staying commented out).
…-reduction # Conflicts: # go.mod # go.sum
The debug-vs-summary distinction is already clear from log().Debugf plus the Infof summary line; the comment restated it.
Pavani-Panakanti
approved these changes
Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The userspace conntrack GC logs one
infoline per stale entry it deletes, every cleanup cycle (CleanupConntrackMap/Cleanupv6ConntrackMap). On an idle cluster this single line dominates the agent's log output — in one measurement it was ~84–98% of all lines (hundreds of lines every 5‑minute cycle with essentially no workload).Change
Conntrack cleanup Delete - Conntrack Key : ...line frominfotodebug(full 5-tuple detail preserved).infosummary instead:Done cleanup of conntrack map: deleted N stale entries out of M tracked (per-entry detail at debug level).Why this shape
The shipped default log level is
debug, so this is intentionally not a silent drop:--log-level=debug(default): behavior is unchanged in content — every deleted flow's full tuple is still logged, just correctly taggeddebug, plus the new summary. This preserves debuggability for flow-level issues (e.g. the port-reuse GC race), where the source port of the evicted flow is exactly what you need.--log-level=info: the per-entry flood disappears and you get one summary line per cycle with the deleted/tracked counts. This makesinfoa usable, low-volume mode — previously the flood was info, so there was no way to shed it without losing everything.Live A/B test (fresh nodes, identical load)
Built into an image and deployed on a 3-node EKS cluster. Nodes were recycled via ASG instance refresh first so each started with an empty conntrack map and a fresh log file (rules out any pre-existing entries). Then the same network-policy'd churn workload (client pods doing tight HTTP request loops → large short-lived flow / DNS turnover) was run for two back-to-back windows on one node, changing only the log level between them:
Conntrack cleanup Deletelines emittedlevel:debug)Same GC work in both windows (tens of thousands of stale entries deleted per cycle); the only difference is the log level. At
info, the per-entry flood is fully suppressed and each cycle collapses to a single summary line — the three info-window cycles deleted 75,313 / 51,433 / 54,361 entries respectively yet produced just 10 total log lines.INFO — per-cycle summary (verbatim):
{"level":"info","msg":"Done cleanup of conntrack map: deleted 75313 stale entries out of 80564 tracked (per-entry detail at debug level)"}DEBUG — per-entry line, full detail preserved (verbatim):
{"level":"debug","msg":"Conntrack cleanup Delete - Conntrack Key : Source IP - 192.168.27.168 Source port - 55006 Dest IP - 10.100.0.10 Dest port - 53 Protocol - 17 Owner IP - 192.168.27.168 Ifindex - 828"}BEFORE — same line on current
main(emitted atinfo, one per deleted entry):{"level":"info","msg":"Conntrack cleanup Delete - Conntrack Key : Source IP - 192.168.27.168 Source port - 55006 Dest IP - 10.100.0.10 Dest port - 53 Protocol - 17 Owner IP - 192.168.27.168 Ifindex - 828"}Testing
go build ./...,go vet ./pkg/ebpf/conntrack/...clean.go test ./pkg/ebpf/... ./controllers/... ./pkg/rpc/... ./pkg/fwruleprocessor/...pass (no test asserts on these log lines).infothe conntrack-delete flood collapses to one summary per cycle; atdebugfull per-entry detail remains.