-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Feature Summary
Add a log cleanup and retention mechanism for server logs
Motivation
While inspecting the server files, I noticed that the /logs/ directory accumulates a large number of log files in a relatively short time. Over longer runtimes this may be unnecessary and could lead to disk usage growth or operational issues.
Proposed Solution
- Add this to the container entrypoint (before Java starts)
# --- Log hygiene --------------------------------------------------
LOG_DIR="/home/container/game/Server/logs"
MAX_LOG_FILES="${MAX_LOG_FILES:-20}"
LOG_RETENTION_DAYS="${LOG_RETENTION_DAYS:-14}"
mkdir -p "$LOG_DIR"
# Remove stale Java lock files
find "$LOG_DIR" -name "*.lck" -type f -delete || true
# Delete logs older than retention period
find "$LOG_DIR" -type f -name "*.log" -mtime +"$LOG_RETENTION_DAYS" -delete || true
# Keep only the newest N log files
ls -1t "$LOG_DIR"/*.log 2>/dev/null | tail -n +"$((MAX_LOG_FILES + 1))" | xargs -r rm -f- Optional environment variables (documented, not required)
environment:
MAX_LOG_FILES: 20
LOG_RETENTION_DAYS: 14Additional Context
This request came up while troubleshooting a startup issue caused by stale .log.lck files after container restarts. Cleaning up old logs and lock files on startup would also help avoid similar edge cases in restart loops or crash recovery scenarios.
Note: I am not a programmer, just network engineer, the "code" above is generated by AI and I haven't tested it myself.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request