Repository navigation
feat(logs): structured logs, a log viewer and sending to syslog - #284
Merged
Merged
Conversation
Every process (API, workers, watcher) writes structured, redacted log records to the console (text or JSON), to a rotating JSON-lines file per process under data_dir/logs, and, when turned on, to a syslog server (RFC 5424 over UDP, TCP or TLS) from a background queue. Settings → Logs sets the level, per-logger levels, files and syslog, shows the latest lines from every process, and sends a test line. Off-box sending is off by default; LENS_LOG_LEVEL and LENS_LOG_FORMAT win over Settings. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ENYWvvG9ffuX4mAJN61ACV
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ENYWvvG9ffuX4mAJN61ACV
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ENYWvvG9ffuX4mAJN61ACV
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ENYWvvG9ffuX4mAJN61ACV
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ENYWvvG9ffuX4mAJN61ACV
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ENYWvvG9ffuX4mAJN61ACV
Merged
16 of 22 tasks
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.
Requested by Adeel · project thread
Description
Before: the API logged plain text at a fixed INFO level, workers printed to stdout, and the only way to read logs was
docker logs. Nothing could go to a log server.After: every process (API,
lens worker,lens watch) writes structured, redacted records. Settings → Logs sets the level (plus per-logger levels likehttpx warning), console format (text or JSON), and log files, shows the latest lines from every process with search and filters, and can send lines to a syslog server (RFC 5424 over UDP, TCP or TLS) with a "Send a test line" button. Sending off-box is off by default.LENS_LOG_LEVELandLENS_LOG_FORMATin .env win over Settings.How:
app/domain/logs.pyadds handlers to the root logger: the console, a rotating JSON-lines file per process underdata_dir/logs(read back byGET /admin/logs), and a syslog handler that queues lines and sends them from a background thread, so a slow or down server never blocks a request; when the queue is full lines are dropped and counted. Bearer/basic credentials,key=/token=/password=pairs, URL passwords and common key shapes are replaced with***before anything is written. Settings are re-applied whenever they're saved, so changes take effect without a restart. Uvicorn's access and error logs go through the same outputs. New endpoints:GET /admin/logs,GET /settings/logs/status,POST /settings/logs/test.Motivation and Context
Adeel asked for logging, and for sending logs to a remote syslog server. Lens already had a syslog sensor, which receives logs; this adds sending them out.
Types of changes
!in the title)Checklist:
make hookschecks it on commit).docs/accordingly.## UnreleasedinCHANGELOG.md.Not built yet: sending directly to Loki or other HTTP endpoints, and TLS client certificates.
🤖 Generated with Claude Code
https://claude.ai/code/session_01ENYWvvG9ffuX4mAJN61ACV
Generated by Claude Code