Merge branch 'perf/long-range-studies' into release/2.3.0

# Conflicts:
#	CHANGELOG.md
This commit is contained in:
Lucas Rayan committed 2026-11-23 09:13:32 -03:00
commit f9a6783a1f
16 files changed
+846 -83

No files matched your search

+4
View File
@@ -176,6 +176,10 @@ What enters: malicious events (scanner, exploit, bruteforce, ssh-fail, ssh-probe
Failure behavior: a full disk, the size cap or the day cap drop events (counted, logged at most once in a while, never fatal); a corrupted line is skipped when reading; a partial line left by an earlier failure is terminated before the next write.
### How studies read the registry
Period, funnel, metrics, campaigns and the other studies read the registry through `evlog.ScanRecs` and `ScanRefs`. A closed day (any day before the current UTC day) never changes, so it is decoded once into a compact form (strings interned per day, 112 bytes per event) and kept in memory under a cap of 96 MB (`evlog.Options.CacheMem`, negative disables it), least recently used first. A day is read again when the size or modification time of its files changes (a late line, a compression pass). The current day is always read live from the file, so the result matches a full scan exactly; sessions and campaigns that cross midnight are built over the events of the whole window, never per day. A study holds only 16-byte references to the decoded events and rebuilds those of one address when it builds that address' sessions (in parallel). Period, funnel and metrics of the same window share one scan and one set of sessions for the 30 s result lifetime. The byte budget (256 MB) counts only what is read from disk; the event count (1,500,000) and the 10 s deadline remain, and `truncated` is true only when one of them is hit (the dashboard then shows a note). First request after a restart decodes the days (3 in parallel); later ones are served from memory.
## Intelligence
The investigation layer is computed from the IP table and the registry, with no external API: