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