Skip to content

BE: Removal of stdout.log - #1672

Merged
jokob-sk merged 2 commits into
mainfrom
next_release
Jun 14, 2026
Merged

BE: Removal of stdout.log#1672
jokob-sk merged 2 commits into
mainfrom
next_release

Conversation

@jokob-sk

@jokob-sk jokob-sk commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Documentation

    • Updated debugging and troubleshooting guides to reference app.log (instead of stdout.log) for backend and plugin log inspection.
    • Refreshed API docs for available/allowed log files, removing stdout.log from the purgeable list.
  • Chores

    • Updated runtime logging configuration and startup scripts to stop creating stdout.log, using app.log and other dedicated log files instead.
    • Adjusted maintenance log cleanup to target app.log/error logs only.
  • Bug Fixes

    • Updated log purging and MCP log resource exposure to no longer accept or reference stdout.log.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: eff55448-b881-4182-9daf-c60b022c2783

📥 Commits

Reviewing files that changed from the base of the PR and between 76e7cc7 and 83b10b4.

📒 Files selected for processing (1)
  • front/plugins/maintenance/maintenance.py

📝 Walkthrough

Walkthrough

stdout.log is removed from the project's logging infrastructure. The logResult helper that wrote subprocess output to stdout.log/stderr.log is deleted from server/logger.py and its call sites cleaned up. API allowlists, the MCP resource listing, maintenance plugin log cleanup, install scripts, Dockerfiles, and all developer documentation are updated to reference app.log instead.

Changes

stdout.log removal and app.log migration

Layer / File(s) Summary
Remove logResult helper and usages
server/logger.py, server/helper.py
Deletes the logResult(stdout, stderr) function that appended subprocess output to stdout.log/stderr.log, removes its import from helper.py, and replaces its call in initialiseFile() with a commented-out stub.
Server API allowlist and MCP resource update
server/api_server/openapi/schemas.py, server/api_server/logs_endpoint.py, server/api_server/mcp_endpoint.py
Removes stdout.log from the ALLOWED_LOG_FILES Literal schema and from the clean_log endpoint allowlist; updates the MCP _list_resources() backend log entry from stdout.log to app.log.
Maintenance plugin rewrite and tail_file helper
front/plugins/maintenance/maintenance.py, front/php/components/logs_defaults.json
Drops the deque-based trimming, rewrites MAINT_LOG_LENGTH cleanup to target only app.log and nginx-error.log with size-aware truncation logic, adds the new tail_file() reverse-read helper that reads files backwards in 8KB blocks, and removes the stdout.log maintenance entry from logs_defaults.json.
Dockerfile and install script log initialization
Dockerfile, Dockerfile.debian, .devcontainer/Dockerfile, install/debian12/start.debian12.sh, install/production-filesystem/services/start-backend.sh, install/proxmox/proxmox-install-netalertx.sh, install/ubuntu24/install.sh
Removes ENV LOG_STDOUT from all three Dockerfiles and adds new log path env vars; removes stdout.log from touch initialization commands across install scripts; updates start-backend.sh to read extra Python parameters from a config file and merge stderr into stdout via 2>&1 instead of redirecting to stdout.log.
Documentation updates
docs/API_LOGS.md, docs/API_OLD.md, docs/DOCKER_COMPOSE.md, docs/PLUGINS_DEV.md, docs/PLUGINS_DEV_DATASOURCES.md, docs/PLUGINS_DEV_DATA_CONTRACT.md, docs/PLUGINS_DEV_QUICK_START.md, docs/PLUGINS_DEV_SETTINGS.md
Replaces all /tmp/log/stdout.log references with /tmp/log/app.log in plugin developer guides, removes stdout.log from API allowed-files tables in API_LOGS.md and API_OLD.md, and adds a Docker Compose bind-mount note.

Possibly related PRs

  • netalertx/NetAlertX#1300: Both PRs modify the log-maintenance logic in front/plugins/maintenance/maintenance.py (main switches MAINT_LOG_LENGTH cleanup/truncation behavior away from stdout.log, while the linting PR also changes that module's log-trimming implementation).
  • netalertx/NetAlertX#1303: Both PRs modify the backend service startup script (install/production-filesystem/services/start-backend.sh), touching how extra Python parameters are read/applied and how stdout/stderr are redirected/handled.
  • netalertx/NetAlertX#1235: Both PRs touch container runtime logging behavior; main PR removes stdout.log/redirects stdout logging, while the retrieved PR also modifies the backend start-backend.sh stdout/stderr redirection logic.

Poem

🐇 Hop hop, stdout.log is gone today,
No more stray file to lead devs astray.
app.log shines with a tidy new name,
The tail_file helper joins the game.
With every touch and Dockerfile cleaned,
The log forest is finally serene! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'BE: Removal of stdout.log' accurately describes the main change across the pull request—removing stdout.log logging functionality throughout backend code, configuration, and documentation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch next_release

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/API_LOGS.md (1)

19-26: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Missing app_front.log from the documented allowed files list.

The API_LOGS.md "Allowed Files" section lists 6 files, but the backend implementation in server/api_server/logs_endpoint.py explicitly allows 7 files. The list is missing app_front.log, which users can legitimately purge via the DELETE endpoint.

Add app_front.log to the allowed files list
 **Allowed Files:**
 

app.log
+app_front.log
IP_changes.log
stderr.log
app.php_errors.log
execution_queue.log
db_is_locked.log

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/API_LOGS.md` around lines 19 - 26, The "Allowed Files" section in
docs/API_LOGS.md is missing app_front.log, which is actually allowed by the
backend implementation in server/api_server/logs_endpoint.py. Add app_front.log
to the documented list in the correct alphabetical position between app.log and
IP_changes.log to ensure the documentation matches the backend implementation
and users know they can legitimately purge this file.
🧹 Nitpick comments (1)
server/api_server/logs_endpoint.py (1)

28-31: ⚡ Quick win

Avoid duplicated log allowlists across schema and runtime.

Line [28] duplicates ALLOWED_LOG_FILES from server/api_server/openapi/schemas.py. This can drift and desync documented validation from runtime behavior.

♻️ Suggested consolidation
 import os
 import sys
+from typing import get_args
 from flask import jsonify
@@
 from const import logPath  # noqa: E402 [flake8 lint suppression]
 from logger import mylog, Logger  # noqa: E402 [flake8 lint suppression]
 from helper import get_setting_value  # noqa: E402 [flake8 lint suppression]
 from messaging.in_app import write_notification  # noqa: E402 [flake8 lint suppression]
+from api_server.openapi.schemas import ALLOWED_LOG_FILES  # noqa: E402 [flake8 lint suppression]
@@
-    allowed_files = [
-        'app.log', 'app_front.log', 'IP_changes.log', 'stderr.log',
-        'app.php_errors.log', 'execution_queue.log', 'db_is_locked.log'
-    ]
+    allowed_files = list(get_args(ALLOWED_LOG_FILES))
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@server/api_server/logs_endpoint.py` around lines 28 - 31, The allowed_files
list in logs_endpoint.py duplicates the ALLOWED_LOG_FILES constant that already
exists in server/api_server/openapi/schemas.py, creating a maintenance risk
where the two lists could drift out of sync. Import the ALLOWED_LOG_FILES
constant from the schemas module and replace the hardcoded allowed_files list
with a reference to this imported constant to maintain a single source of truth
for the allowed log file names.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@front/plugins/maintenance/maintenance.py`:
- Around line 43-74: The if block that handles files exceeding MAX_TAIL_SIZE
(starting around line 59) is truncating the file to empty with f.truncate(0),
which discards all log content instead of preserving the recent entries. Replace
this truncate-to-empty approach with the same logic used in the else branch:
call tail_file(logFile, MAINT_LOG_LENGTH) to extract the last MAINT_LOG_LENGTH
lines, then open the file, seek to the beginning, truncate, and write those
lines back. This ensures that even large logs keep their configured tail instead
of being completely wiped.

---

Outside diff comments:
In `@docs/API_LOGS.md`:
- Around line 19-26: The "Allowed Files" section in docs/API_LOGS.md is missing
app_front.log, which is actually allowed by the backend implementation in
server/api_server/logs_endpoint.py. Add app_front.log to the documented list in
the correct alphabetical position between app.log and IP_changes.log to ensure
the documentation matches the backend implementation and users know they can
legitimately purge this file.

---

Nitpick comments:
In `@server/api_server/logs_endpoint.py`:
- Around line 28-31: The allowed_files list in logs_endpoint.py duplicates the
ALLOWED_LOG_FILES constant that already exists in
server/api_server/openapi/schemas.py, creating a maintenance risk where the two
lists could drift out of sync. Import the ALLOWED_LOG_FILES constant from the
schemas module and replace the hardcoded allowed_files list with a reference to
this imported constant to maintain a single source of truth for the allowed log
file names.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f9d2135c-4ed5-4dd6-bf56-c403a60a2fbf

📥 Commits

Reviewing files that changed from the base of the PR and between 718c2a9 and 76e7cc7.

📒 Files selected for processing (22)
  • .devcontainer/Dockerfile
  • Dockerfile
  • Dockerfile.debian
  • docs/API_LOGS.md
  • docs/API_OLD.md
  • docs/DOCKER_COMPOSE.md
  • docs/PLUGINS_DEV.md
  • docs/PLUGINS_DEV_DATASOURCES.md
  • docs/PLUGINS_DEV_DATA_CONTRACT.md
  • docs/PLUGINS_DEV_QUICK_START.md
  • docs/PLUGINS_DEV_SETTINGS.md
  • front/php/components/logs_defaults.json
  • front/plugins/maintenance/maintenance.py
  • install/debian12/start.debian12.sh
  • install/production-filesystem/services/start-backend.sh
  • install/proxmox/proxmox-install-netalertx.sh
  • install/ubuntu24/install.sh
  • server/api_server/logs_endpoint.py
  • server/api_server/mcp_endpoint.py
  • server/api_server/openapi/schemas.py
  • server/helper.py
  • server/logger.py
💤 Files with no reviewable changes (6)
  • Dockerfile.debian
  • .devcontainer/Dockerfile
  • front/php/components/logs_defaults.json
  • docs/API_OLD.md
  • server/logger.py
  • Dockerfile

Comment thread front/plugins/maintenance/maintenance.py Outdated
@jokob-sk
jokob-sk merged commit 62c4833 into main Jun 14, 2026
6 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant