Documentation Index
Fetch the complete documentation index at: https://docs.ditto.live/llms.txt
Use this file to discover all available pages before exploring further.
This content is for SDK V4. For the latest version, see the V5 documentation.
Logging Rotation in Ditto
Core System
Ditto uses a customditto-rotating-file crate that provides thread-safe rotating file writers with automatic compression.
Rotation Triggers
Files rotate based on two criteria:- Size limit: Default 1MB uncompressed (configurable 1MB-1GB)
- Age limit: Default 24 hours (configurable 1+ hours)
File Management
- Naming:
ditto-logs-YYYY-MM-DD-HH-MM-SS.microseconds.log - Compression: Automatic gzip compression when rotated (
.log→.log.gz) - Retention: Default 15 files maximum (configurable 3-64 files)
Configuration Parameters
| Parameter | Default | Range | Description |
|---|---|---|---|
rotating_log_file_max_size_mb | 1MB | 1MB-1GB | Size trigger for rotation |
rotating_log_file_max_age_h | 24 | 1+ hours | Age trigger for rotation |
rotating_log_file_max_files_on_disk | 15 | 3-64 files | Maximum files to retain |
Key Features
- Multi-threaded compression in background
- Automatic cleanup of oldest files when limit exceeded
- Runtime reconfiguration without restart
- Export functionality for diagnostics
- Crash recovery - compresses leftover uncompressed files on startup
Integration
- Uses
tracing-subscriberwith JSON formatting - Always logs at DEBUG level to disk (independent of console level)
- Filtered to prevent recursive logging from the rotation system itself
Disk Usage
The system maintains approximately ~15MB disk usage by default (15 × 1MB compressed files) and handles rotation completely automatically with robust error recovery.Related Documentation
- For debugging specific issues, see Troubleshooting
- For remote log collection, see Device Observability