Files
mev-beta/orig/scripts/deprecated/rotate-logs.sh
Administrator c54c569f30 refactor: move all remaining files to orig/ directory
Completed clean root directory structure:
- Root now contains only: .git, .env, docs/, orig/
- Moved all remaining files and directories to orig/:
  - Config files (.claude, .dockerignore, .drone.yml, etc.)
  - All .env variants (except active .env)
  - Git config (.gitconfig, .github, .gitignore, etc.)
  - Tool configs (.golangci.yml, .revive.toml, etc.)
  - Documentation (*.md files, @prompts)
  - Build files (Dockerfiles, Makefile, go.mod, go.sum)
  - Docker compose files
  - All source directories (scripts, tests, tools, etc.)
  - Runtime directories (logs, monitoring, reports)
  - Dependency files (node_modules, lib, cache)
  - Special files (--delete)

- Removed empty runtime directories (bin/, data/)

V2 structure is now clean:
- docs/planning/ - V2 planning documents
- orig/ - Complete V1 codebase preserved
- .env - Active environment config (not in git)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 10:53:05 +01:00

37 lines
957 B
Bash
Executable File

#!/bin/bash
# Log rotation script for MEV Bot
# Configuration
LOG_DIR="/home/administrator/projects/mev-beta/logs"
MAX_SIZE_MB=100
RETENTION_DAYS=30
# Rotate event logs when they exceed MAX_SIZE_MB
rotate_large_logs() {
echo "Checking for large logs to rotate..."
# Find log files larger than MAX_SIZE_MB
find "$LOG_DIR/events" -name "*.jsonl" -size +${MAX_SIZE_MB}M | while read logfile; do
echo "Rotating large log: $logfile"
# Compress the log file
gzip "$logfile"
# Move to archived directory
mv "${logfile}.gz" "$LOG_DIR/archived/"
done
}
# Clean up old archived logs
cleanup_old_logs() {
echo "Cleaning up archived logs older than $RETENTION_DAYS days..."
find "$LOG_DIR/archived" -name "*.gz" -mtime +$RETENTION_DAYS -delete
}
# Main execution
echo "Starting log rotation for MEV Bot..."
rotate_large_logs
cleanup_old_logs
echo "Log rotation completed."