# Gordon v2 - Comprehensive Logging Configuration Example # Demonstrates all logging features and configurations [server] port = 8080 registry_port = 5000 registry_domain = "registry.yourdomain.com" runtime = "auto" data_dir = "./data" [registry_auth] enabled = true username = "admin" password = "secure-password" # ============================================================================ # LOGGING CONFIGURATION EXAMPLES # ============================================================================ # Basic logging setup - good for most users [logging] enabled = true # Enable file-based logging (default: false) level = "info" # Log level: trace, debug, info, warn, error (default: info) dir = "./logs" # Directory for log files (default: ./logs) main_log_file = "gordon.log" # Main application log file (default: gordon.log) proxy_log_file = "proxy.log" # HTTP proxy traffic log file (default: proxy.log) container_log_dir = "containers" # Container logs subdirectory (default: containers) # Log rotation settings max_size = 100 # Max log file size in MB before rotation (default: 100) max_backups = 5 # Number of old log files to keep (default: 5) max_age = 30 # Max age in days to keep old log files (default: 30) compress = true # Compress old log files with gzip (default: true) # ============================================================================ # ALTERNATIVE LOGGING CONFIGURATIONS # ============================================================================ # Development logging configuration (uncomment to use) # [logging] # enabled = true # level = "debug" # More verbose for debugging # dir = "./dev-logs" # main_log_file = "gordon-dev.log" # proxy_log_file = "proxy-dev.log" # container_log_dir = "containers" # max_size = 10 # Smaller files for development # max_backups = 3 # Less history needed # max_age = 7 # Keep logs for 1 week # compress = false # No compression for faster access # Production logging configuration (uncomment to use) # [logging] # enabled = true # level = "warn" # Only warnings and errors in production # dir = "/var/log/gordon" # System log directory # main_log_file = "gordon.log" # proxy_log_file = "proxy.log" # container_log_dir = "containers" # max_size = 200 # Larger files for production # max_backups = 15 # More history for analysis # max_age = 90 # Keep logs for 3 months # compress = true # Save disk space # High-traffic logging configuration (uncomment to use) # [logging] # enabled = true # level = "error" # Only errors to reduce log volume # dir = "/var/log/gordon" # main_log_file = "gordon.log" # proxy_log_file = "proxy.log" # container_log_dir = "containers" # max_size = 500 # Very large files for high traffic # max_backups = 20 # Extensive history # max_age = 180 # Keep logs for 6 months # compress = true # Essential for large files # Minimal logging configuration (uncomment to use) # [logging] # enabled = true # level = "error" # Only log errors # dir = "./logs" # max_size = 50 # Small files # max_backups = 2 # Minimal history # max_age = 14 # 2 weeks retention # compress = true # Disable logging (console output only) - uncomment to use # [logging] # enabled = false # Only console output, no files # ============================================================================ # LOG STRUCTURE CREATED BY GORDON # ============================================================================ # # When logging is enabled, Gordon creates this structure: # # ./logs/ # Main log directory (permissions: 0700) # ├── gordon.log # Main application logs (permissions: 0600) # ├── gordon.log.1.gz # Rotated logs (compressed) # ├── gordon.log.2.gz # ├── proxy.log # HTTP proxy traffic logs (permissions: 0600) # ├── proxy.log.1.gz # Rotated proxy logs # └── containers/ # Container logs directory (permissions: 0700) # ├── abc123def456.log # Container logs by ID (permissions: 0600) # ├── def456ghi789.log # ├── myapp_yourdomain_com.log # Symlink to container ID for easier access # └── api_yourdomain_com.log # Symlink to container ID for easier access # # ============================================================================ # WHAT GETS LOGGED # ============================================================================ # # Main Application Logs (gordon.log): # - Server startup and shutdown events # - Container lifecycle events (deploy, start, stop, remove) # - Configuration changes and hot reloads # - Registry operations (push/pull events) # - Error conditions and warnings # - Authentication events # - Auto-route creation events # # Proxy Logs (proxy.log): # - All HTTP/HTTPS requests through the reverse proxy # - Request method, URL, response code, response time # - Client IP addresses and user agents # - SSL/TLS connection information # - Upstream container routing decisions # # Container Logs (containers/*.log): # - Real-time stdout/stderr from each container # - Timestamped application output # - Container startup and shutdown messages # - Application errors and debug output # - Custom application logging # # ============================================================================ # SECURITY FEATURES # ============================================================================ # # - Log directories created with 0700 permissions (owner-only access) # - Log files created with 0600 permissions (owner read/write only) # - Automatic log rotation prevents disk space exhaustion # - Sensitive information (passwords, tokens) is automatically redacted # - Container logs are isolated per container for security analysis # # ============================================================================ # LOG MONITORING COMMANDS # ============================================================================ # # Real-time monitoring: # tail -f logs/gordon.log # Watch main application logs # tail -f logs/proxy.log # Monitor HTTP traffic # tail -f logs/containers/*.log # Follow all container logs # # Log analysis: # grep -i error logs/gordon.log # Find errors in main logs # grep "deploy" logs/gordon.log # Find deployment events # awk '{print $9}' logs/proxy.log | sort | uniq -c # HTTP status code analysis # grep "container" logs/gordon.log | tail -20 # Recent container events # # ============================================================================ [routes] "app.yourdomain.com" = "myapp:latest" "api.yourdomain.com" = "myapi:latest" "logs.yourdomain.com" = "logviewer:latest" # Example log viewing service # Example environment variables configuration [env] dir = "./data/env" providers = ["pass"] # With comprehensive logging enabled, you can: # 1. Monitor all HTTP traffic to your applications # 2. Debug container deployment issues # 3. Analyze application performance # 4. Track security events and access patterns # 5. Maintain audit trails for compliance # 6. Troubleshoot network and routing issues