TL;DR: Why the Phantom 1 TB Spike Happened

If your UniFi router claims a device burned through hundreds of gigabytes of SSL/TLS traffic in a single day while the device itself disagrees, here is the short version:

  • You didn't use 1 TB, and encryption didn't cause it: Encrypted packets still have an exact size on the wire (WireGuard only adds ~32–60 bytes per packet, or ~2–4%). The router's own MongoDB (ace_stat.stat_daily) recorded 81.50 GB for all of October and a 15.95 GB peak day—right in line with the laptop's Windows Data Usage (~60 GB on WireGuard, ~100 GB total).
  • The router contradicted itself: Querying every time-series collection in MongoDB (stat_daily, stat_hourly, stat_5minutes, stat_archive) for any entry over 50 GB returned zero results. Even so, the UniFi Network 10.6.101 UI showed a 556 GB SSL/TLS spike that survived a reboot.
  • Likely culprit: Process checks showed a separate flow collector (dpi-flow-stats, polling every 5 seconds under ubios-udapi-server) running alongside PostgreSQL 14. Because I cleared Traffic Identification History before locating the raw 556 GB row on disk, the best explanation by elimination is a flow-counter bug in dpi-flow-stats rather than real traffic.

1. The Anomaly: 1 TB on the Router vs. ~60–100 GB on the Endpoint

A routine look at UniFi Network (10.6.101) on a UniFi Dream Router 7 (UDR7) turned up a strange number: a single Windows 11 laptop (DEV-LAPTOP, anonymized MAC 02:42:ac:11:00:42, IP 192.168.0.144) had supposedly used nearly 1 TB of SSL/TLS traffic in 30 days, mostly from one 556 GB spike.

On the laptop, Windows 11 Data usage (Settings -> Network & internet -> Advanced network settings -> Data usage) told a completely different story: ~60 GB on the WireGuard VPN adapter and ~100 GB across all interfaces for the same 30-day window (checked live; no screenshot saved before clearing router stats).

That raised an obvious question: does VPN encryption throw off router byte counters, or was one of the two dashboards wrong?

Encryption doesn't inflate byte counts by 10x. Every Ethernet frame or IP packet has a fixed physical wire length (tot_len), and WireGuard's headers plus ChaCha20-Poly1305 tags only add ~32–60 bytes per packet. A 10x gap almost always points to per-adapter scoping on the endpoint or a flow-accounting bug in the router's DPI pipeline.

2. Checking the Endpoint: Windows Data Usage UI vs. Live Adapter Counters

Before blaming the router, it helps to know how Windows 11 counts traffic—and what PowerShell's network commands actually show.

Windows 11's Data usage page has a per-adapter dropdown in the top-right (Wi-Fi, Ethernet, or virtual adapters like WireGuard's wintun), backed by SRUDB.dat over a rolling 30-day window. Selecting the WireGuard adapter shows only tunnel payload (~60 GB here). Switching to the physical Wi-Fi adapter adds UDP overhead plus any off-VPN or LAN traffic (~100 GB total).

To verify live counters and active connections from PowerShell (and rule out a runaway background process), run:

# 1. Inspect raw NDIS byte counters across all physical and virtual adapters SINCE LAST BOOT
Get-NetAdapterStatistics -IncludeHidden | Select-Object Name, ReceivedBytes, SentBytes | Format-Table -AutoSize

# 2. List active connection profiles
Get-NetConnectionProfile | Select-Object Name, InterfaceAlias, NetworkCategory

# 3. Inspect active UDP endpoints and established TCP processes (check for port 443 tunnels)
Get-NetUDPEndpoint | Where-Object {$_.LocalPort -ne 0} | Select-Object LocalAddress, LocalPort, OwningProcess
Get-Process -Id (Get-NetTCPConnection -State Established).OwningProcess | Select-Object Name, Id -Unique

And from Command Prompt:

netsh wlan show interfaces
netsh interface ipv4 show subinterfaces

One caveat: I did not dump C:\Windows\System32\sru\SRUDB.dat during this incident. Remember that Get-NetAdapterStatistics and netsh only count bytes since the last reboot or adapter reset, so they can't confirm a 30-day total if the laptop has rebooted.

Even without SRUDB.dat, the router's own chart narrowed things down fast: every normal day sat between 0.15 GB and 15.95 GB, except for that single 556 GB SSL/TLS bar.

3. How UniFi Classifies WireGuard vs. SSL/TLS

It's easy to assume UniFi just mislabeled the WireGuard tunnel as SSL/TLS. The router's MongoDB records (shown in Section 5) proved otherwise:

  • WireGuard lands under unidentified: In stat_daily and stat_monthly, the laptop's WireGuard UDP traffic is logged as unidentified-rx_bytes (8.24 GB of 8.45 GB RX on Oct 2; 24.18 GB in September)—not SSL/TLS (185_20).
  • SSL/TLS (185_20) is direct port-443 traffic: Whenever WireGuard was off (or bypassed), standard HTTPS and QUIC traffic landed under 185_20-rx_bytes (30.54 GB in September; 2.09 GB on Oct 7; 2.84 GB on Oct 8).

That leaves two ways the 556 GB spike ended up in SSL/TLS:

  • Possibility A: The counter bug hit a real port-443 HTTPS/QUIC flow outside the VPN.
  • Possibility B: dpi-flow-stats classified a mid-stream or port-443 fallback flow as SSL/TLS even while ace_stat logged the UDP tunnel as unidentified. Because I cleared Traffic Identification History before finding the raw 556 GB record, I can't prove which one happened.

4. UniFi Web Debug Terminal Quirks (The Missing Underscore Trap)

To see what the UDR7 had actually stored on disk, I opened the browser Debug Terminal (Settings -> System -> Advanced -> Debug Terminal, or via the device panel on 192.168.0.1).

UniFi's web terminal (xterm.js over WebSocket) has three annoying quirks:

  • Multi-line paste race: Pasting mongo --port 27117 followed by queries lets /bin/sh swallow the queries while mongo starts, then execute raw JavaScript in /bin/sh when you hit Ctrl+C (/bin/sh: 5: Syntax error: word unexpected).
  • 80-column hard wrap: Long single-line --eval commands get split with literal newlines mid-string, causing SyntaxError: unterminated string literal.
  • Stripped _ and ~: Pasting silently drops underscores and tildes or turns them into spaces (stat_daily becomes stat daily, rx_bytes becomes rx bytes).

The workaround: Replace every _ with @ and pipe through tr '@' '_' straight into mongo --quiet:

echo 'db.getCollectionNames()' | tr '@' '_' | mongo --port 27117 ace@stat --quiet

That one-liner gives clean, scriptable access to MongoDB right from the browser terminal.

5. Inside MongoDB (ace vs. ace_stat) on UniFi Network 10.6.101

UniFi runs a local MongoDB v3.6.23 on 127.0.0.1:27117 with two main databases:

  • ace: Configuration state (device, user, wlanconf, firewall_policy, dpiapp, traffic_rule).
  • ace_stat: Historical time-series telemetry.

Listing ace_stat collections on Network 10.6.101 showed a notable schema change:

[
        "downtime",
        "pingtest",
        "stat_5minutes",
        "stat_archive",
        "stat_daily",
        "stat_hourly",
        "stat_life",
        "stat_minute",
        "stat_monthly",
        "wifi_connectivity_event"
]

Discovery #1: Standalone stat_dpi is gone. Older UniFi guides reference db.stat_dpi, which no longer exists in Network 10.6.101.

Discovery #2: DPI counters are now embedded subdocuments. Here is a raw stat_daily document (2026-10-02) for the laptop (oid: "02:42:ac:11:00:42"):

echo 'db.stat@daily.findOne({oid:"02:42:ac:11:00:42",datetime:ISODate("2026-10-02T00:00:00Z")})' | tr '@' '_' | mongo --port 27117 ace@stat --quiet
{
        "_id" : ObjectId("6ac8ca773c56db07dcda994b"),
        "bytes" : 62089260.05,
        "datetime" : ISODate("2026-10-02T00:00:00Z"),
        "dpi" : {
                "185_20-rx_bytes" : NumberLong(14912),
                "185_20-rx_packets" : NumberLong(65),
                "185_20-tx_bytes" : NumberLong(9822),
                "185_20-tx_packets" : NumberLong(77),
                "bytes" : NumberLong("8676233202"),
                "rx_bytes" : NumberLong("8449915386"),
                "tx_bytes" : NumberLong(226317816),
                "unidentified-rx_bytes" : NumberLong("8240565132"),
                "unidentified-tx_bytes" : NumberLong(198386209),
                "unidentified-rx_packets" : NumberLong(5829172),
                "unidentified-tx_packets" : NumberLong(1349354)
        },
        "duration" : 45900,
        "o" : "user",
        "oid" : "02:42:ac:11:00:42",
        "rx_bytes" : 36304258.59166667,
        "Site_id" : "5f9a1b2c3d4e5f6a7b8c9d0e",
        "time" : NumberLong("1790899200000"),
        "tx_bytes" : 25785001.458333332,
        "user" : "02:42:ac:11:00:42"
}

And the September stat_monthly rollup (2026-09-01T04:00:00Z):

echo 'db.stat@monthly.find({user:"02:42:ac:11:00:42"},{"datetime":1,"dpi.bytes":1,"dpi.rx@bytes":1,"dpi.185@20-rx@bytes":1,"dpi.unidentified-rx@bytes":1})' | tr '@' '_' | mongo --port 27117 ace@stat --quiet
{ "_id" : ObjectId("6abddd192f665b060b13986c"), "dpi" : { "rx_bytes" : 45802928178, "185_20-rx_bytes" : 30538192766, "unidentified-rx_bytes" : 24179999841, "bytes" : 76715165528 }, "datetime" : ISODate("2026-09-01T04:00:00Z") }

Three things jump out from these records:

  • Fractional top-level counters: rx_bytes (36.3 MB) and tx_bytes (25.8 MB) have decimals (.59166667, .458333332). Since raw packets are integers, these appear to be time-interpolated Wi-Fi radio rollups across AP polling intervals.
  • Exact nested DPI counters: dpi.bytes (8,676,233,202 bytes = 8.68 GB) uses exact 64-bit integers (NumberLong) from the gateway DPI engine.
  • App buckets (185_20 vs. unidentified): 185_20 is SSL/TLS (Category 185, App 20). unidentified-rx_bytes (8.24 GB of 8.45 GB RX on Oct 2; 24.18 GB in September) almost certainly reflects the WireGuard UDP tunnel.

6. Dumping the Entire Month: Did MongoDB Hold the 556 GB Spike?

Next, I pulled every October stat_daily document for 02:42:ac:11:00:42 using DBQuery.shellBatchSize=100:

echo 'DBQuery.shellBatchSize=100;db.stat@daily.find({oid:"02:42:ac:11:00:42"},{datetime:1,bytes:1,"dpi.bytes":1,"dpi.rx@bytes":1}).sort({datetime:1})' | tr '@' '_' | mongo --port 27117 ace@stat --quiet

Here is the full October 2026 ledger from ace_stat.stat_daily (right column is dpi.bytes in decimal GB, 1 GB = 10^9 bytes):

Date (UTC)   | Top-Level bytes      | dpi.bytes (raw B)    | dpi.rx_bytes (raw B) | Actual Daily Total (10^9 GB)
-------------+----------------------+----------------------+----------------------+-----------------------------
2026-10-01   |         6,897,077.56 |        5,075,863,365 |        4,929,264,539 |  5.08 GB
2026-10-02   |        62,089,260.05 |        8,676,233,202 |        8,449,915,386 |  8.68 GB
2026-10-03   |        61,603,855.70 |        1,488,822,499 |        1,401,562,906 |  1.49 GB
2026-10-04   |         6,753,157.09 |        3,693,742,000 |        3,623,234,376 |  3.69 GB
2026-10-05   |        51,690,992.22 |        2,078,348,960 |        1,949,916,000 |  2.08 GB
2026-10-06   |         5,834,531.69 |          651,984,752 |          602,380,683 |  0.65 GB
2026-10-07   |        27,982,812.92 |        3,005,237,510 |        2,913,800,829 |  3.01 GB
2026-10-08   |       128,872,306.85 |        2,772,418,743 |        2,618,225,532 |  2.77 GB
2026-10-09   |        21,392,704.93 |        2,413,590,320 |        2,286,743,667 |  2.41 GB
2026-10-10   |        23,510,598.71 |        2,158,314,435 |        1,997,298,427 |  2.16 GB
2026-10-11   |        22,879,236.22 |          149,887,082 |          123,789,297 |  0.15 GB
2026-10-12   |        28,539,871.88 |        2,312,069,144 |        2,175,856,144 |  2.31 GB
2026-10-13   |        42,744,487.84 |        1,004,158,951 |          950,625,776 |  1.00 GB
2026-10-14   |        40,618,772.00 |        1,045,879,595 |          949,077,310 |  1.05 GB
2026-10-15   |        28,744,189.09 |        3,015,969,109 |        2,835,442,638 |  3.02 GB
2026-10-16   |        26,881,134.97 |        1,580,295,851 |        1,500,813,581 |  1.58 GB
2026-10-17   |     2,455,647,003.75 |        3,626,870,835 |        1,148,136,161 |  3.63 GB  <-- Accounting shift begins
2026-10-18   |     1,636,054,515.10 |        1,648,370,136 |            8,546,118 |  1.65 GB
2026-10-19   |     2,789,738,672.18 |        2,803,560,791 |            8,927,183 |  2.80 GB
2026-10-20   |    15,823,287,937.33 |       15,949,440,371 |           86,931,967 | 15.95 GB  <-- Highest true day
2026-10-21   |       812,188,832.16 |          835,709,264 |           19,731,641 |  0.84 GB
2026-10-22   |     1,510,596,248.46 |        1,535,109,327 |           20,400,263 |  1.54 GB
2026-10-23   |       812,482,633.90 |          825,204,132 |           10,127,322 |  0.83 GB
2026-10-24   |       493,655,281.47 |          508,828,588 |           12,068,857 |  0.51 GB
2026-10-25   |     1,277,908,979.29 |        1,290,938,402 |           10,125,082 |  1.29 GB
2026-10-26   |       468,940,382.22 |          749,737,085 |          271,329,398 |  0.75 GB  <-- Accounting shift ends
2026-10-27   |        11,642,843.62 |        2,340,740,563 |        2,190,683,423 |  2.34 GB
2026-10-28   |         8,342,970.39 |        2,535,281,284 |        2,414,225,021 |  2.54 GB
2026-10-29   |        25,431,663.04 |        2,118,529,432 |        2,010,276,812 |  2.12 GB
2026-10-30   |        33,572,140.48 |        2,299,367,436 |        2,155,705,088 |  2.30 GB
2026-10-31   |         7,561,946.00 |        1,310,331,134 |        1,244,026,574 |  1.31 GB
-------------+----------------------+----------------------+----------------------+-----------------------------
TOTAL        |                      |       81,500,834,298 |       50,909,985,882 | 81.50 GB (75.90 GiB)

Two things stand out immediately:

  • No 556 GB spike in MongoDB: Total dpi.bytes for October is 81,500,834,298 bytes (81.50 GB decimal / 75.90 GiB binary), with a peak of 15.95 GB (14.85 GiB) on Oct 20. Even the all-time stat_life counter for this MAC was only 109,500,835,969 bytes (109.50 GB / 101.98 GiB across September and October combined).
  • Unexplained 9-day accounting shift (Oct 17 – Oct 26): Top-level bytes jumped ~100x to track dpi.bytes (0.51–15.95 GB), while dpi.rx_bytes dropped to megabytes (8.5–271 MB) before snapping back on Oct 27. This likely lines up with a UniFi OS or Network update changing rollup attribution, though the exact cause is still an open question.

To make sure the 556 GB spike wasn't sitting under another MAC or table, I ran threshold queries across stat_daily, stat_hourly, stat_5minutes, and stat_archive for anything over 50 GB (or 100 GB of SSL/TLS):

echo 'db.stat@daily.find({"dpi.bytes":{$gt:50000000000}},{datetime:1,oid:1,o:1,"dpi.bytes":1})' | tr '@' '_' | mongo --port 27117 ace@stat --quiet
echo 'db.stat@hourly.find({"dpi.185@20-rx@bytes":{$gt:100000000000}},{datetime:1,oid:1,"dpi.185@20-rx@bytes":1})' | tr '@' '_' | mongo --port 27117 ace@stat --quiet
echo 'db.stat@5minutes.find({"dpi.bytes":{$gt:500000000000}},{user:1,datetime:1,"dpi.bytes":1})' | tr '@' '_' | mongo --port 27117 ace@stat --quiet
echo 'db.stat@archive.find({"dpi.bytes":{$gt:500000000000}},{user:1,datetime:1,"dpi.bytes":1})' | tr '@' '_' | mongo --port 27117 ace@stat --quiet

Every single query returned zero documents. So if MongoDB only saw 81.50 GB, where did the dashboard get 556 GB?

7. Where I Think the Spike Lives

Modern UniFi OS consoles don't rely solely on MongoDB. Checking running processes with ps aux showed a second telemetry stack running alongside it:

ps aux | grep -iE "postgres|clickhouse|dpi|utm"
root      6403  0.0  0.0  20760  1488 ?        Ss   05:57   0:00 /sbin/utmdaemon -C 1 -o 1
root      6404  0.8  0.8 552756 32292 ?        Sl   05:57  12:19 /usr/sbin/dpi-flow-stats --config /run/dpi/dpi.cfg
postgres  3128  0.0  0.5 216024 21456 ?        Ss   05:56   0:04 /usr/lib/postgresql/14/bin/postgres -D /data/postgresql/14/main/data -c config_file=/etc/postgresql/14/main/postgresql.conf

Looking at /run/dpi/dpi.cfg and the open file descriptors for dpi-flow-stats (PID 6404):

cat /run/dpi/dpi.cfg
ls -l /proc/6404/fd
# Generated automatically by ubios-udapi-server
wifi-port=10101
fprint=1
refresh-interval=5
geoip=1
l-wx------ 1 root root 64 Oct 30 20:15 22 -> '/run/.ubios-udapi-server.pid5638.000000007.120s.log.8b19_1dcd_4f85_b69e.lock (deleted)'
lr-x------ 1 root root 64 Oct 30 20:15 13 -> /proc/nf_dpi/mdns_count
lr-x------ 1 root root 64 Oct 30 20:15 14 -> /proc/nf_dpi/mdns_data
lrwx------ 1 root root 64 Oct 30 20:15 16 -> 'socket:[31588]'
lr-x------ 1 root root 64 Oct 30 20:15 6  -> 'pipe:[31189]'

PostgreSQL 14 (su - postgres -c "psql -P pager=off -l") also runs 9 databases on the console (unifi-core, ulp-go, ulp-go-syslog, ucs-agent, unifi-directory, unifi-identity-update, plus system DBs).

Proven vs. inferred: We know dpi-flow-stats polls /proc/nf_dpi/* every 5 seconds (refresh-interval=5), is managed by ubios-udapi-server, and talks over local sockets and pipes while PostgreSQL 14 runs nearby. However, /proc/6404/fd doesn't show the exact storage file, and I cleared Traffic Identification History before searching PostgreSQL or /data for the 556 GB row. The diagram below is therefore an inferred pipeline by elimination:

# Inferred Telemetry Pipeline (Leading Theory — IPC & flow backing store inferred by elimination)

[ Client Traffic on br0 (WireGuard UDP + Port-443 TLS) ]
               |
               v
  [ Linux Kernel nf_conntrack + /proc/nf_dpi ]  (Shown: /proc/6404/fd)
               |
               +---> [dpi-flow-stats (5s poll)] ---> [Inferred: ubios-udapi-server IPC -> Flow Store / Postgres]
               |     (Shown: PID 6404, dpi.cfg)       (Suspected home of the 556 GB SSL/TLS UI spike)
               |
               +---> [AP / Gateway Inform Rollup] -> [Shown: MongoDB :27117 ace_stat.stat_daily]
                                                      (Proven clean: 81.50 GB / 75.90 GiB Oct total)

Why 556 GB isn't a basic integer wrap: An unsigned 64-bit underflow (2^64 - 1) jumps to ~18.4 exabytes, a signed 64-bit underflow goes negative, and an unsigned 32-bit wrap (2^32) is only 4.29 GB. A 556 GB (~5.97 × 10^11 bytes) spike points to a different bug—like dpi-flow-stats repeatedly adding a cumulative total on each 5-second poll instead of taking a delta, double-counting merged flows, or reading an uninitialized struct.

Possible trigger: A laptop sleep/wake cycle or a 5 GHz / 6 GHz Wi-Fi roam may have disrupted an active flow mid-poll. Because I didn't note the exact date of the 556 GB bar before clearing history, I couldn't line it up with db.wifi_connectivity_event or Windows power logs (Kernel-Power Event IDs 42/107).

8. Why Rebooting Didn't Clear the 556 GB Spike

During troubleshooting, I rebooted the UDR7 and grepped /var/log/messages for 556.

  • Nothing in syslog: utmdaemon and dpi-flow-stats write binary/integer counters straight to storage, not human-readable gigabyte totals to /var/log/messages.
  • Reboots don't wipe historical stats: Rebooting clears the live nf_conntrack table in RAM (stopping a runaway counter), but the 556 GB figure was already saved to persistent storage on /data.

9. Fixing the Spike (and What to Check Next Time)

If your UniFi gateway shows an impossible single-day SSL/TLS spike:

  • 1. Clear Traffic Identification History (Confirmed Fix): Go to Settings -> System -> Advanced -> Clear Traffic Identification History (or Settings -> Security / Traffic Identification -> Clear History depending on your Network 10.x version). This immediately removed the 556 GB bar from the UI. (Note: I didn't re-query MongoDB afterward to see whether it also wipes dpi.* inside ace_stat.stat_daily.)
  • 2. Live Flow Reset via SSH (Untested — Use Caution): If a counter is actively climbing and you want to reset live state without a reboot, flush conntrack for that client and restart the DPI daemons:
# WARNING: Flushing conntrack immediately drops active TCP/UDP sessions for this client IP
conntrack -D -s 192.168.0.144

# Note: Untested on this page. On UniFi OS, dpi-flow-stats and utmdaemon may be
# supervised by ubios-udapi-server rather than standalone systemd units:
systemctl restart dpi-flow-stats utmdaemon
  • 3. What to capture before clearing next time: Record the exact spike date and check db.wifi_connectivity_event, search PostgreSQL (unifi-core, ulp-go) and /data for the raw byte value (~550000000000–610000000000), and re-run the stat_daily query after clearing history to see which stores get truncated.