logging.toml RawHistoryFolder
1# Gordon v2 - Comprehensive Logging Configuration Example
2# Demonstrates all logging features and configurations
3
4[server]
5port = 8080
6registry_port = 5000
7registry_domain = "registry.yourdomain.com"
8runtime = "auto"
9data_dir = "./data"
10
11[registry_auth]
12enabled = true
13username = "admin"
14password = "secure-password"
15
16# ============================================================================
17# LOGGING CONFIGURATION EXAMPLES
18# ============================================================================
19
20# Basic logging setup - good for most users
21[logging]
22enabled = true # Enable file-based logging (default: false)
23level = "info" # Log level: trace, debug, info, warn, error (default: info)
24dir = "./logs" # Directory for log files (default: ./logs)
25main_log_file = "gordon.log" # Main application log file (default: gordon.log)
26proxy_log_file = "proxy.log" # HTTP proxy traffic log file (default: proxy.log)
27container_log_dir = "containers" # Container logs subdirectory (default: containers)
28
29# Log rotation settings
30max_size = 100 # Max log file size in MB before rotation (default: 100)
31max_backups = 5 # Number of old log files to keep (default: 5)
32max_age = 30 # Max age in days to keep old log files (default: 30)
33compress = true # Compress old log files with gzip (default: true)
34
35# ============================================================================
36# ALTERNATIVE LOGGING CONFIGURATIONS
37# ============================================================================
38
39# Development logging configuration (uncomment to use)
40# [logging]
41# enabled = true
42# level = "debug" # More verbose for debugging
43# dir = "./dev-logs"
44# main_log_file = "gordon-dev.log"
45# proxy_log_file = "proxy-dev.log"
46# container_log_dir = "containers"
47# max_size = 10 # Smaller files for development
48# max_backups = 3 # Less history needed
49# max_age = 7 # Keep logs for 1 week
50# compress = false # No compression for faster access
51
52# Production logging configuration (uncomment to use)
53# [logging]
54# enabled = true
55# level = "warn" # Only warnings and errors in production
56# dir = "/var/log/gordon" # System log directory
57# main_log_file = "gordon.log"
58# proxy_log_file = "proxy.log"
59# container_log_dir = "containers"
60# max_size = 200 # Larger files for production
61# max_backups = 15 # More history for analysis
62# max_age = 90 # Keep logs for 3 months
63# compress = true # Save disk space
64
65# High-traffic logging configuration (uncomment to use)
66# [logging]
67# enabled = true
68# level = "error" # Only errors to reduce log volume
69# dir = "/var/log/gordon"
70# main_log_file = "gordon.log"
71# proxy_log_file = "proxy.log"
72# container_log_dir = "containers"
73# max_size = 500 # Very large files for high traffic
74# max_backups = 20 # Extensive history
75# max_age = 180 # Keep logs for 6 months
76# compress = true # Essential for large files
77
78# Minimal logging configuration (uncomment to use)
79# [logging]
80# enabled = true
81# level = "error" # Only log errors
82# dir = "./logs"
83# max_size = 50 # Small files
84# max_backups = 2 # Minimal history
85# max_age = 14 # 2 weeks retention
86# compress = true
87
88# Disable logging (console output only) - uncomment to use
89# [logging]
90# enabled = false # Only console output, no files
91
92# ============================================================================
93# LOG STRUCTURE CREATED BY GORDON
94# ============================================================================
95#
96# When logging is enabled, Gordon creates this structure:
97#
98# ./logs/ # Main log directory (permissions: 0700)
99# ├── gordon.log # Main application logs (permissions: 0600)
100# ├── gordon.log.1.gz # Rotated logs (compressed)
101# ├── gordon.log.2.gz
102# ├── proxy.log # HTTP proxy traffic logs (permissions: 0600)
103# ├── proxy.log.1.gz # Rotated proxy logs
104# └── containers/ # Container logs directory (permissions: 0700)
105# ├── abc123def456.log # Container logs by ID (permissions: 0600)
106# ├── def456ghi789.log
107# ├── myapp_yourdomain_com.log # Symlink to container ID for easier access
108# └── api_yourdomain_com.log # Symlink to container ID for easier access
109#
110# ============================================================================
111# WHAT GETS LOGGED
112# ============================================================================
113#
114# Main Application Logs (gordon.log):
115# - Server startup and shutdown events
116# - Container lifecycle events (deploy, start, stop, remove)
117# - Configuration changes and hot reloads
118# - Registry operations (push/pull events)
119# - Error conditions and warnings
120# - Authentication events
121# - Auto-route creation events
122#
123# Proxy Logs (proxy.log):
124# - All HTTP/HTTPS requests through the reverse proxy
125# - Request method, URL, response code, response time
126# - Client IP addresses and user agents
127# - SSL/TLS connection information
128# - Upstream container routing decisions
129#
130# Container Logs (containers/*.log):
131# - Real-time stdout/stderr from each container
132# - Timestamped application output
133# - Container startup and shutdown messages
134# - Application errors and debug output
135# - Custom application logging
136#
137# ============================================================================
138# SECURITY FEATURES
139# ============================================================================
140#
141# - Log directories created with 0700 permissions (owner-only access)
142# - Log files created with 0600 permissions (owner read/write only)
143# - Automatic log rotation prevents disk space exhaustion
144# - Sensitive information (passwords, tokens) is automatically redacted
145# - Container logs are isolated per container for security analysis
146#
147# ============================================================================
148# LOG MONITORING COMMANDS
149# ============================================================================
150#
151# Real-time monitoring:
152# tail -f logs/gordon.log # Watch main application logs
153# tail -f logs/proxy.log # Monitor HTTP traffic
154# tail -f logs/containers/*.log # Follow all container logs
155#
156# Log analysis:
157# grep -i error logs/gordon.log # Find errors in main logs
158# grep "deploy" logs/gordon.log # Find deployment events
159# awk '{print $9}' logs/proxy.log | sort | uniq -c # HTTP status code analysis
160# grep "container" logs/gordon.log | tail -20 # Recent container events
161#
162# ============================================================================
163
164[routes]
165"app.yourdomain.com" = "myapp:latest"
166"api.yourdomain.com" = "myapi:latest"
167"logs.yourdomain.com" = "logviewer:latest" # Example log viewing service
168
169# Example environment variables configuration
170[env]
171dir = "./data/env"
172providers = ["pass"]
173
174# With comprehensive logging enabled, you can:
175# 1. Monitor all HTTP traffic to your applications
176# 2. Debug container deployment issues
177# 3. Analyze application performance
178# 4. Track security events and access patterns
179# 5. Maintain audit trails for compliance
180# 6. Troubleshoot network and routing issues