Helios provides comprehensive configuration history tracking, allowing you to monitor all changes to your configuration over time, compare versions, and restore to any previous state.
The configuration history system automatically tracks every configuration change with:
- Timestamp of when the change occurred
- Change type (reload, migration, rollback, restore, etc.)
- Source of the change (API, CLI, file watching, signal)
- User who made the change (when available)
- Full configuration snapshot
- Detailed field-level changes
Every configuration change is automatically recorded:
Version 1 [a1b2c3d4]
Timestamp: 2025-02-04 15:30:45
Change Type: initial
Source: startup
Description: Initial configuration load
Version 2 [e5f6g7h8]
Timestamp: 2025-02-04 15:35:12
Change Type: reload
Source: api
User: admin
Changes: 3 field(s) modified
| Type | Description |
|---|---|
initial |
First configuration load at startup |
reload |
Configuration reloaded via API or signal |
file_watch |
Automatic reload from file system watcher |
migration |
Migration applied to configuration |
rollback |
Migration rollback performed |
restore |
Configuration restored from backup or history |
manual |
Manual change via API |
| Source | Description |
|---|---|
startup |
Application startup |
api |
HTTP API call |
cli |
Command-line tool |
file_watch |
Automatic file watching |
signal |
SIGHUP signal handler |
migration |
Migration system |
List configuration change history.
Query Parameters:
limit(optional): Maximum entries to return (default: 50)offset(optional): Pagination offsetchange_type(optional): Filter by change typesource(optional): Filter by sourceuser(optional): Filter by useridorversion(optional): Get specific entry
Response:
{
"entries": [
{
"id": "a1b2c3d4e5f6g7h8",
"version": 5,
"timestamp": "2025-02-04T15:35:12Z",
"change_type": "reload",
"source": "api",
"user": "admin",
"description": "Updated rate limiting settings",
"config_hash": "sha256...",
"changes": [
{
"field": "requests_per_second",
"old_value": 1000,
"new_value": 2000,
"category": "rate_limiting"
}
],
"tags": ["manual"]
}
],
"total": 25,
"offset": 0,
"limit": 50,
"has_more": false
}Get history statistics.
Response:
{
"total_entries": 25,
"oldest_entry": "2025-01-01T00:00:00Z",
"newest_entry": "2025-02-04T15:35:12Z",
"current_version": 25,
"changes_by_type": {
"initial": 1,
"reload": 18,
"migration": 5,
"rollback": 1
},
"changes_by_source": {
"startup": 1,
"api": 15,
"file_watch": 8,
"migration": 5
},
"average_interval": "2h30m",
"storage_size_bytes": 125840
}Compare two history versions.
Query Parameters:
from(required): Source version numberto(required): Target version number
Response:
{
"version_a": 1,
"version_b": 5,
"timestamp_a": "2025-01-01T00:00:00Z",
"timestamp_b": "2025-02-04T15:35:12Z",
"changes": [
{
"field": "observability.log_level",
"old_value": "INFO",
"new_value": "DEBUG",
"category": "observability"
}
],
"total_changes": 8,
"added_fields": ["performance.circuit_breaker_enabled"],
"removed_fields": [],
"modified_fields": ["observability.log_level", "rate_limiting.requests_per_second"]
}Restore configuration to a specific history version.
Request Body:
{
"version": 3,
"user": "admin",
"description": "Rolling back to known good state"
}Response:
{
"success": true,
"message": "Restored configuration to version 3",
"version": 3
}Clear or purge history entries.
Query Parameters:
older_than_hours(optional): Purge entries older than specified hours
Examples:
# Purge entries older than 720 hours (30 days)
DELETE /admin/config/history?older_than_hours=720
# Clear all history
DELETE /admin/config/historyThe helios-migrate tool includes history commands:
# View recent history (default 20 entries)
helios-migrate history -config config.yaml
# View more entries
helios-migrate history -config config.yaml -limit 50
# Output as JSON
helios-migrate history -config config.yaml -jsonExample output:
Configuration Change History
============================
Total Entries: 25 (showing 20)
Version 25 [a1b2c3d4]
Timestamp: 2025-02-04 15:35:12
Change Type: reload
Source: api
User: admin
Description: Updated rate limiting
Changes: 3 field(s) modified
Version 24 [e5f6g7h8]
Timestamp: 2025-02-04 14:20:00
Change Type: file_watch
Source: file_watch
Changes: 1 field(s) modified
...
helios-migrate history-stats -config config.yamlExample output:
Configuration History Statistics
================================
Total Entries: 25
Current Version: 25
Oldest Entry: 2025-01-01 00:00:00
Newest Entry: 2025-02-04 15:35:12
Avg Interval: 2h30m0s
Storage Size: 125840 bytes
Changes by Type:
initial : 1
reload : 18
migration : 5
rollback : 1
Changes by Source:
startup : 1
api : 15
file_watch : 8
migration : 5
helios-migrate history-compare -config config.yaml -from 1 -to 25Example output:
Configuration Version Comparison
=================================
Version 1 (2025-01-01 00:00:00) → Version 25 (2025-02-04 15:35:12)
Total Changes: 8
Added Fields:
+ performance.circuit_breaker_enabled
+ auth.session_timeout
Modified Fields:
~ observability.log_level
~ rate_limiting.requests_per_second
~ timeouts.read_timeout
Detailed Changes:
observability.log_level:
Old: INFO
New: DEBUG
rate_limiting.requests_per_second:
Old: 1000
New: 2000
helios-migrate history-restore -config config.yaml -version 20Example output:
Restoring configuration to version 20...
✓ Configuration restored to version 20 successfully!
import "github.com/helios/helios/internal/config"
// Create manager (history is enabled automatically)
manager, err := config.NewManager("config.yaml")
if err != nil {
log.Fatal(err)
}
// Check if history is enabled
if manager.IsHistoryEnabled() {
// Get history
history, err := manager.GetHistory(&config.HistoryQuery{
Limit: 10,
ChangeType: config.ChangeTypeReload,
})
// Get statistics
stats, err := manager.GetHistoryStats()
// Compare versions
comparison, err := manager.CompareHistoryVersions(1, 5)
// Restore to version
err := manager.RestoreHistoryVersion(3, "admin", "Rolling back")
}import "github.com/helios/helios/internal/config"
// Create history manager
historyMgr, err := config.NewHistoryManager("config.yaml", &config.HistoryConfig{
HistoryDir: ".helios/history",
MaxEntries: 1000,
AutoSnapshot: true,
})
// Record a change
entry, err := historyMgr.RecordChange(
oldConfig, newConfig,
config.ChangeTypeReload,
config.SourceAPI,
"admin",
"Updated rate limiting",
[]string{"manual", "rate-limiting"},
)
// Get entry by version
entry, err := historyMgr.GetEntry("5")
// Get snapshot
snapshot, err := historyMgr.GetSnapshot(5)
// Purge old entries
purged, err := historyMgr.PurgeOldEntries(30 * 24 * time.Hour)History tracking is enabled automatically with sensible defaults:
// Default configuration
&config.HistoryConfig{
HistoryDir: ".helios/history", // Directory for history files
MaxEntries: 1000, // Maximum entries to keep
AutoSnapshot: true, // Save full snapshots
}History is stored in the .helios/history directory relative to the config file:
config.yaml
.helios/
history/
index.yaml # History index file
snapshot_a1b2c3d4.yaml # Full config snapshot
snapshot_e5f6g7h8.yaml
...
The index file contains metadata for all history entries, while individual snapshots are stored in separate files for efficient retrieval.
- Regular Monitoring: Periodically check history stats to monitor configuration change patterns
- Before Major Changes: Always note the current version before making significant changes
- Use Descriptions: Provide meaningful descriptions when making changes via API
- Periodic Cleanup: Purge old history entries to manage storage
- Compare Before Restore: Always compare versions before restoring to understand what will change
- Backup Integration: History complements but doesn't replace regular backups
Every configuration reload is automatically recorded in history:
// These all create history entries automatically
manager.Reload()
manager.ReloadWithContext(config.ChangeTypeManual, config.SourceAPI, "admin", "Manual update", nil)Migration operations are tracked with detailed context:
Version 10 [m1n2o3p4]
Timestamp: 2025-02-04 10:00:00
Change Type: migration
Source: migration
Description: Applied 3 migrations (v2 → v5)
Tags: [migration]
Automatic reloads from file watching are recorded:
Version 15 [q5r6s7t8]
Timestamp: 2025-02-04 11:30:00
Change Type: file_watch
Source: file_watch
Description: Automatic reload from file change
- Check if history is enabled:
manager.IsHistoryEnabled() - Verify the history directory is writable
- Check for errors in application logs
Snapshots might be missing if:
AutoSnapshotwas disabled- The snapshot file was manually deleted
- Max entries limit caused automatic cleanup
If history storage grows too large:
- Reduce
MaxEntriesin configuration - Periodically purge old entries
- Consider disabling
AutoSnapshotfor less critical environments