Increase daemon log rotation limits for production use
- Max size: 10MB → 50MB per file - Max backups: 3 → 7 files - Max age: 7 → 30 days - Updated tests and documentation Resolves bd-t7ds 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
11
CHANGELOG.md
11
CHANGELOG.md
@@ -9,6 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Improved
|
||||
|
||||
- **Daemon Log Rotation**: Increased default rotation limits for better production use (bd-t7ds)
|
||||
- Max size increased from 10MB to 50MB per file
|
||||
- Max backups increased from 3 to 7 files
|
||||
- Max age increased from 7 to 30 days
|
||||
- Added comprehensive documentation in CONFIG.md
|
||||
- Better handles long-running daemons with high log output
|
||||
|
||||
- **Git Pre-Push Hook**: Better error messaging and auto-sync option
|
||||
- Error message now suggests `bd sync` instead of manual git commands
|
||||
- Interactive prompt offers to run `bd sync` automatically
|
||||
@@ -1233,9 +1240,9 @@ See README.md for hash ID format details and birthday paradox collision analysis
|
||||
- Includes comprehensive test coverage
|
||||
- **Log Rotation**: Automatic daemon log rotation with configurable limits (bd-154)
|
||||
- Prevents unbounded log file growth for long-running daemons
|
||||
- Configurable via environment variables: `BEADS_DAEMON_LOG_MAX_SIZE`, `BEADS_DAEMON_LOG_MAX_BACKUPS`, `BEADS_DAEMON_LOG_MAX_AGE`
|
||||
- Configurable via environment variables: `BEADS_DAEMON_LOG_MAX_SIZE`, `BEADS_DAEMON_LOG_MAX_BACKUPS`, `BEADS_DAEMON_LOG_MAX_AGE`, `BEADS_DAEMON_LOG_COMPRESS`
|
||||
- Optional compression of rotated logs
|
||||
- Defaults: 10MB max size, 3 backups, 7 day retention, compression enabled
|
||||
- Defaults: 50MB max size, 7 backups, 30 day retention, compression enabled
|
||||
- **Batch Deletion**: Enhanced `bd delete` command with batch operations (bd-127)
|
||||
- Delete multiple issues at once: `bd delete bd-1 bd-2 bd-3 --force`
|
||||
- Read from file: `bd delete --from-file deletions.txt --force`
|
||||
|
||||
@@ -18,9 +18,9 @@ func (d *daemonLogger) log(format string, args ...interface{}) {
|
||||
|
||||
// setupDaemonLogger creates a rotating log file logger for the daemon
|
||||
func setupDaemonLogger(logPath string) (*lumberjack.Logger, daemonLogger) {
|
||||
maxSizeMB := getEnvInt("BEADS_DAEMON_LOG_MAX_SIZE", 10)
|
||||
maxBackups := getEnvInt("BEADS_DAEMON_LOG_MAX_BACKUPS", 3)
|
||||
maxAgeDays := getEnvInt("BEADS_DAEMON_LOG_MAX_AGE", 7)
|
||||
maxSizeMB := getEnvInt("BEADS_DAEMON_LOG_MAX_SIZE", 50)
|
||||
maxBackups := getEnvInt("BEADS_DAEMON_LOG_MAX_BACKUPS", 7)
|
||||
maxAgeDays := getEnvInt("BEADS_DAEMON_LOG_MAX_AGE", 30)
|
||||
compress := getEnvBool("BEADS_DAEMON_LOG_COMPRESS", true)
|
||||
|
||||
logF := &lumberjack.Logger{
|
||||
|
||||
@@ -107,19 +107,19 @@ func TestLogFileRotationDefaults(t *testing.T) {
|
||||
os.Unsetenv("BEADS_DAEMON_LOG_MAX_AGE")
|
||||
os.Unsetenv("BEADS_DAEMON_LOG_COMPRESS")
|
||||
|
||||
maxSize := getEnvInt("BEADS_DAEMON_LOG_MAX_SIZE", 10)
|
||||
if maxSize != 10 {
|
||||
t.Errorf("Expected default max size 10, got %d", maxSize)
|
||||
maxSize := getEnvInt("BEADS_DAEMON_LOG_MAX_SIZE", 50)
|
||||
if maxSize != 50 {
|
||||
t.Errorf("Expected default max size 50, got %d", maxSize)
|
||||
}
|
||||
|
||||
maxBackups := getEnvInt("BEADS_DAEMON_LOG_MAX_BACKUPS", 3)
|
||||
if maxBackups != 3 {
|
||||
t.Errorf("Expected default max backups 3, got %d", maxBackups)
|
||||
maxBackups := getEnvInt("BEADS_DAEMON_LOG_MAX_BACKUPS", 7)
|
||||
if maxBackups != 7 {
|
||||
t.Errorf("Expected default max backups 7, got %d", maxBackups)
|
||||
}
|
||||
|
||||
maxAge := getEnvInt("BEADS_DAEMON_LOG_MAX_AGE", 7)
|
||||
if maxAge != 7 {
|
||||
t.Errorf("Expected default max age 7, got %d", maxAge)
|
||||
maxAge := getEnvInt("BEADS_DAEMON_LOG_MAX_AGE", 30)
|
||||
if maxAge != 30 {
|
||||
t.Errorf("Expected default max age 30, got %d", maxAge)
|
||||
}
|
||||
|
||||
compress := getEnvBool("BEADS_DAEMON_LOG_COMPRESS", true)
|
||||
|
||||
@@ -38,6 +38,10 @@ Tool-level settings you can configure:
|
||||
| `actor` | `--actor` | `BD_ACTOR` | `$USER` | Actor name for audit trail |
|
||||
| `flush-debounce` | - | `BEADS_FLUSH_DEBOUNCE` | `5s` | Debounce time for auto-flush |
|
||||
| `auto-start-daemon` | - | `BEADS_AUTO_START_DAEMON` | `true` | Auto-start daemon if not running |
|
||||
| `daemon-log-max-size` | - | `BEADS_DAEMON_LOG_MAX_SIZE` | `50` | Max daemon log size in MB before rotation |
|
||||
| `daemon-log-max-backups` | - | `BEADS_DAEMON_LOG_MAX_BACKUPS` | `7` | Max number of old log files to keep |
|
||||
| `daemon-log-max-age` | - | `BEADS_DAEMON_LOG_MAX_AGE` | `30` | Max days to keep old log files |
|
||||
| `daemon-log-compress` | - | `BEADS_DAEMON_LOG_COMPRESS` | `true` | Compress rotated log files |
|
||||
|
||||
### Example Config File
|
||||
|
||||
@@ -54,6 +58,12 @@ flush-debounce: 10s
|
||||
|
||||
# Auto-start daemon (default true)
|
||||
auto-start-daemon: true
|
||||
|
||||
# Daemon log rotation settings
|
||||
daemon-log-max-size: 50 # MB per file (default 50)
|
||||
daemon-log-max-backups: 7 # Number of old logs to keep (default 7)
|
||||
daemon-log-max-age: 30 # Days to keep old logs (default 30)
|
||||
daemon-log-compress: true # Compress rotated logs (default true)
|
||||
```
|
||||
|
||||
`.beads/config.yaml` (project-specific):
|
||||
|
||||
Reference in New Issue
Block a user