Repository navigation
Add the FOG 1.6 Log Viewer page over the fog-node log file - #213
Merged
Merged
Conversation
Adds GET /logviewer and POST /api/v1/log/tail: the end of the fog-node log (#208) in the browser, under Logging, as the FOG 1.6 Log Viewer. Gated by setting.read, as 1.6 gates it under settings (Tom, 2026-11-17). - Only fog-node.log and .1 to .5 are readable, by exact name, and only as regular files (lstat, bigint). The server builds the path; after the open, fstat dev/ino must match the listed file, so a file swapped for a symlink answers 400. The descriptor is closed on every path. - The tail reads backwards in 4096-byte chunks, at most 4 MiB, splits on the newline byte before decoding (no split UTF-8 characters), and stops early if the file shrinks mid-read. - Lines 10 to 1000 (default 100), reverse order, a 10-second poll with Pause and Resume, rendered with textContent. - The log file name, rotation count and fallback folder are exported from api/lib/file-logger.js and shared by config/log.js and the viewer. Closes #209 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #209. Map: #155. Builds on #208 (PR #211, the log file) and #207 (PR #212).
What
GET /logviewerandPOST /api/v1/log/tailshow the end of the fog-node log in the browser, under Logging, as the FOG 1.6 Log Viewer does.setting.read, as 1.6 gates the viewer under settings (Tom, 2026-11-17). There is no new permission.pagehide.File access, a security boundary
fog-node.logand.1to.5can be read. They are matched by exact name and must be regular files (lstat, bigint). A symlink or a folder is never listed.fstatdev/ino must match the listed file, so a file swapped in between answers 400. The descriptor is closed on every path.[]. Any other error answers 500 with a fixed message, and the detail goes to the server log only.textContent.Tail
Shared constants
api/lib/file-logger.jsnow exportsFILE,KEEPandFALLBACK_DIR.config/log.jsand the viewer both use them.api/lib/log-viewer.jsholds the line choices and the read bounds.Tests
npm test: 611 passing.npm run test:uiandnpm run test:ui:prod: all checks pass.test/integration/log-viewer.test.jsandtest/helpers/log-tail.test.jscover the gate, traversal, the symlink and swapped-file cases, the line values, the UTF-8 boundary, the 4 MiB cap, and the sentinel.tools/smoke/checks/log-viewer.js. It covers the<img>line rendered as text, Pause with a fake clock, and Reverse.lstat(alone) fails the symlink test;textContenttoinnerHTMLfails the smoke check;Review
🤖 Generated with Claude Code