Browse documentation

VIRCON

Audit Trail & Rollback

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 TypeDescriptionSeverity
config_changeBot configuration modificationsMedium
permission_grantStaff role grants or promotionsHigh
permission_revokeStaff demotions or removalsHigh
feature_unlockStage/feature lock control changesCritical
database_backupManual database backup triggersLow
rollback_restoreConfiguration rollback executionsCritical
mass_actionBulk ban/kick/warn operationsHigh
integration_changeAPI key creation/revocationMedium

Rollback Workflow

Step-by-step process for safely reverting configuration changes using snapshots.

  1. 1. Admin creates snapshot with ,rollback create before major change.
  2. 2. Snapshot captures: guild config, feature locks, staff permissions, channel settings.
  3. 3. Snapshot stored with timestamp, creator ID, and optional description.
  4. 4. After change is deployed, if issues occur, admin views snapshots with ,rollback list.
  5. 5. Admin previews specific snapshot with ,rollback view to verify correct restore point.
  6. 6. Admin executes ,rollback restore to revert all captured settings.
  7. 7. Rollback execution logged to audit trail with detailed change summary.
  8. 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.

FieldDescription
audit_idAuto-incremented unique identifier.
event_typeType of audited event (see event types table).
actor_discord_idStaff member who triggered the event.
target_discord_idUser affected by event (if applicable).
event_timestampExact time of event occurrence.
event_detailsJSON object with full event context.
before_stateConfiguration/permission state before change.
after_stateConfiguration/permission state after change.
rollback_eligibleBoolean: can this be rolled back.

Snapshot Database Schema

Database structure for storing configuration snapshots and rollback points.

FieldDescription
snapshot_idUnique snapshot identifier.
snapshot_nameHuman-readable snapshot description.
created_byDiscord ID of admin who created snapshot.
created_atTimestamp of snapshot creation.
guild_configJSON snapshot of guild configuration.
staff_permissionsJSON snapshot of staff role assignments.
feature_locksJSON snapshot of feature lock states.
channel_settingsJSON snapshot of bot channel configurations.
restore_countNumber of times this snapshot has been restored.
last_restored_atTimestamp 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.