Repository navigation
[logger] Add in-memory log storage with web UI - #1285
Merged
Merged
Conversation
Add a log store that captures probe and component log messages in memory with a configurable memory ceiling (--log_store_max_mem_mb, default 50MB). The store integrates with the existing logger package so all logs are captured automatically without any probe code changes. Key components: - logger/logstore: Per-source ring buffers with memory-ceiling eviction - logger.SetDefaultLogStore: Thread-safe global store (atomic.Pointer) - logger.ParseLogLevel: Shared log level parser - /logs web endpoint with HTML and JSON views, auto-submit filters, source dropdown, and color-coded log levels Flags: - --log_store_max_mem_mb (default 50, 0 to disable) - --log_store_min_level (default INFO)
3 tasks done
Instead of scanning all buffers on every write once the store is full, allow up to 5% overshoot and evict down to 95% of the ceiling when triggered. This amortizes the O(num_sources) eviction scan over many writes — e.g., ~25K free writes between scans for a 50MB store.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
manugarg
force-pushed
the
add-log-store-core
branch
4 times, most recently
from
April 8, 2026 18:28
175db24 to
a76454a
Compare
Cache /logs page responses for 5 seconds, keyed by full URL (including query params). Add tests for web/logs handler and improve logstore test coverage from 91% to 98%.
manugarg
force-pushed
the
add-log-store-core
branch
from
April 9, 2026 00:00
e69d6ce to
30e8214
Compare
Contributor
Author
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.

Summary
--log_store_max_mem_mb, default 50MB)/logswith HTML and JSON (/logs?format=json) viewsDetails
New package
logger/logstore: Per-source ring buffers (keyed by probe name or component name) backed by a total memory ceiling. When the ceiling is hit, oldest entries are evicted from the buffer using the most memory.Logger integration:
logStorefield added toLogger, auto-attached viaatomic.Pointer-based global default.logAttrs()writes to the store after stderr output. All loggers created afterSetDefaultLogStore()capture logs automatically.Web UI:
/logsendpoint with source dropdown (populated from data), auto-submit filters, color-coded log levels, and JSON output support.Flags:
--log_store_max_mem_mb(default 50, 0 to disable)--log_store_min_level(default INFO)Test plan
go test ./logger/logstore/...— ring buffer, memory ceiling, concurrent access, query filteringgo test ./logger/...— logger integrationgo test ./web/...— web handlergo build ./...— full build passes/logs, verify logs appear