Implement automatic log rotation system to prevent indefinite log growth#92
Draft
Copilot wants to merge 3 commits into
Draft
Implement automatic log rotation system to prevent indefinite log growth#92Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
Co-authored-by: finnie2006 <57916807+finnie2006@users.noreply.github.com>
Co-authored-by: finnie2006 <57916807+finnie2006@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] How to deal with logs growing indefinitely without logrotate ?
Is manuel delete the only solution ?
Implement automatic log rotation system to prevent indefinite log growth
Sep 17, 2025
Copilot stopped work on behalf of
finnie2006 due to an error
September 17, 2025 10:24
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.
Problem
Pterodactyl containers running the webhost egg suffer from logs growing indefinitely without any rotation mechanism. Since Alpine Linux containers don't include
logrotateby default, log files can consume all available disk space over time, requiring manual intervention to delete logs.The main log files affected include:
/home/container/logs/access.log)/home/container/logs/error.log)/home/container/php-fpm.log)Solution
This PR implements a comprehensive, dependency-free log rotation system that automatically manages log files without requiring
logrotateor any external tools.Key Features
Automatic Log Rotation Daemon
Safe Service-Aware Rotation
USR1signals to nginx and PHP-FPM processes to safely reopen log filesConfigurable Retention Policy
LOG_MAX_SIZE: Maximum log file size before rotation (default: 10M)LOG_KEEP_COUNT: Number of rotated log files to retain (default: 5, range: 1-20)LOG_CHECK_INTERVAL: How often to check log sizes in seconds (default: 300, range: 60-3600)User-Friendly Management Tools
scripts/logrotate.sh: Core rotation engine with status, rotate, and daemon modesscripts/logmanager.sh: Simplified interface for common operationsImplementation Details
Shell Compatibility
ash) for full Alpine Linux compatibilitylocalkeywordAutomated Integration
start.shDocumentation
docs/LOG_MANAGEMENT.mdUsage Examples
Basic Status Check
Manual Rotation
Custom Configuration for High-Traffic Server
# Set in Pterodactyl panel environment variables LOG_MAX_SIZE=100M LOG_KEEP_COUNT=10 LOG_CHECK_INTERVAL=180Benefits
This solution completely addresses the original issue by providing an automated alternative to manual log deletion, ensuring Pterodactyl webhost servers can run indefinitely without log-related disk space problems.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.