CHANGE TRACKING
Audit Trail & Rollback System
VIRCON maintains a comprehensive audit trail of all configuration changes, permission grants, and critical bot actions. The rollback system creates snapshots of bot configuration that can be restored instantly in case of errors or unauthorized changes.
Audit & Rollback Commands
Commands for viewing audit trails, creating snapshots, and restoring configurations.
- ,audit [type] [@user] - View audit trail (filter by type/user)
- ,rollback create <snapshot_name> - Create configuration snapshot
- ,rollback list - View all available rollback points
- ,rollback restore <snapshot_id> - Restore configuration from snapshot
- ,rollback view <snapshot_id> - Preview snapshot contents without restoring
Audit Event Types
Categories of logged events with severity levels for change tracking.
| Event Type | Description | Severity |
|---|---|---|
| config_change | Bot configuration modifications | Medium |
| permission_grant | Staff role grants or promotions | High |
| permission_revoke | Staff demotions or removals | High |
| feature_unlock | Stage/feature lock control changes | Critical |
| database_backup | Manual database backup triggers | Low |
| rollback_restore | Configuration rollback executions | Critical |
| mass_action | Bulk ban/kick/warn operations | High |
| integration_change | API key creation/revocation | Medium |
Rollback Workflow
Step-by-step process for safely reverting configuration changes using snapshots.
- 1. Admin creates snapshot with ,rollback create before major change.
- 2. Snapshot captures: guild config, feature locks, staff permissions, channel settings.
- 3. Snapshot stored with timestamp, creator ID, and optional description.
- 4. After change is deployed, if issues occur, admin views snapshots with ,rollback list.
- 5. Admin previews specific snapshot with ,rollback view to verify correct restore point.
- 6. Admin executes ,rollback restore to revert all captured settings.
- 7. Rollback execution logged to audit trail with detailed change summary.
- 8. System sends confirmation to admin channel listing all reverted changes.
Audit Trail Database Schema
Database structure for comprehensive change logging with before/after state capture.
| Field | Description |
|---|---|
| audit_id | Auto-incremented unique identifier. |
| event_type | Type of audited event (see event types table). |
| actor_discord_id | Staff member who triggered the event. |
| target_discord_id | User affected by event (if applicable). |
| event_timestamp | Exact time of event occurrence. |
| event_details | JSON object with full event context. |
| before_state | Configuration/permission state before change. |
| after_state | Configuration/permission state after change. |
| rollback_eligible | Boolean: can this be rolled back. |
Snapshot Database Schema
Database structure for storing configuration snapshots and rollback points.
| Field | Description |
|---|---|
| snapshot_id | Unique snapshot identifier. |
| snapshot_name | Human-readable snapshot description. |
| created_by | Discord ID of admin who created snapshot. |
| created_at | Timestamp of snapshot creation. |
| guild_config | JSON snapshot of guild configuration. |
| staff_permissions | JSON snapshot of staff role assignments. |
| feature_locks | JSON snapshot of feature lock states. |
| channel_settings | JSON snapshot of bot channel configurations. |
| restore_count | Number of times this snapshot has been restored. |
| last_restored_at | Timestamp of most recent restore. |
Automation Features
Automated snapshot creation, audit summaries, and critical event notifications.
- Auto-snapshot before any feature lock control changes.
- Auto-snapshot before bulk permission grants/revokes.
- Daily audit summary report sent to admin channel at 23:00 UTC.
- Critical events (feature unlocks, rollbacks) trigger immediate notifications.
- Snapshot retention: 30 days for manual, 7 days for auto-snapshots.
- Audit trail retention: 180 days (configurable, archives after expiry).
Real-World Use Cases
Practical examples of audit trails and rollbacks preventing and recovering from errors.
Case 1
Head admin accidentally removes all trial mod permissions
Response: View audit trail → identify change → find pre-change snapshot → restore
Outcome: Permissions restored in <2 minutes, minimal disruption
Case 2
Investigating unauthorized feature unlock
Response: Filter audit trail by 'feature_unlock' → identify actor → review justification
Outcome: Rogue admin identified, access revoked, rollback executed
Case 3
Migration to new host causes config loss
Response: Restore from pre-migration snapshot created 1 hour before move
Outcome: Full config recovered, bot operational within 5 minutes
Best Practices
Guidelines for proactive snapshot management and audit trail review.
- Create manual snapshot before major config changes or migrations.
- Review audit trail weekly to detect unauthorized changes.
- Document snapshot names clearly: 'pre-migration-feb-2026' not 'snapshot1'.
- Test rollback on staging/test server before production restore.
- Don't restore snapshots older than 7 days without careful review.
- Use ,rollback view to preview before executing restore.