Skip to main content

Audit Logging

This guide covers Anava's audit logging capabilities, including event types, anomaly detection, compliance reporting, and best practices for security monitoring.

Overview

Anava implements a dual-tier audit logging architecture designed to meet enterprise security and compliance requirements. Every significant action in the system is captured, indexed, and available for review.

What Audit Logging Captures

CategoryExamplesPurpose
AuthenticationLogin, logout, MFA challenges, failed attemptsSecurity monitoring
User ManagementRole changes, account enable/disableAccess control audit
Device OperationsApprove, reject, pause, configureAsset management
Configuration ChangesProfile, skill, group modificationsChange management
System EventsMaintenance mode, errors, health changesOperational visibility

Compliance Coverage

Anava audit logging is designed to satisfy requirements from major compliance frameworks:

StandardKey RequirementsCoverage
SOC 2 Type IICC7.2 - System operations logging40+ event types with immutable storage
ISO 27001A.12.4 - Logging and monitoringDual-tier retention with alerting
PCI DSS10.2 - Audit trail requirementsTamper-proof BigQuery archive
GDPRData access loggingAll credential and data access tracked
HIPAAAudit controlsAccess logs with user attribution

Retention Periods

Audit logs are stored in two tiers optimized for different access patterns:

TierStorageRetentionAccessUse Case
HotFirestore audit_logs90 daysAdmin UIDay-to-day review
ColdBigQuery anava_audit_logs365 daysSQL queriesCompliance audits

Audit logging data flow across hot and cold storage

Viewing Audit Logs

Accessing the Audit Log Viewer

Navigate to Admin > Audit Logs (/admin/audit) to access the Audit Log Viewer.

Required Role: Admin

User Interface Overview

The Audit Log Viewer provides a real-time, filterable view of all system events:

+------------------------------------------------------------------+
| Audit Log Viewer [Export CSV] |
+------------------------------------------------------------------+
| Filters: |
| [Date Range: Last 7 days v] [User: All v] [Action: All v] |
| [Severity: All v] [Search...] [Apply] |
+------------------------------------------------------------------+
| Time | User | Action | Target | Sev |
+-------------|----------------|-----------------|-----------|-----|
| 14:32:15 | admin@co.com | profile.updated | Profile A | - |
| 14:30:02 | ops@co.com | device.approved | CAM-001 | - |
| 14:28:44 | unknown | auth.login_fail | - | MED |
| 14:25:11 | admin@co.com | user.role_chg | viewer@ | LOW |
+------------------------------------------------------------------+
| Showing 1-50 of 1,234 events [< Prev] [1] [2] [3] [Next >]
+------------------------------------------------------------------+

Filtering Options

FilterOptionsDescription
Date RangeLast 24h, 7 days, 30 days, CustomTime window for events
UserAll, Specific userFilter by actor email
Action TypeAuth, Config, Device, User, SystemEvent category
SeverityAll, Low, Medium, High, CriticalAnomaly severity level
SearchFree textSearch across all fields

Real-Time Updates

The Audit Log Viewer supports real-time streaming of new events:

  • Auto-refresh: New events appear at the top automatically
  • Live indicator: Pulsing dot shows active connection
  • Pause/Resume: Click to pause auto-updates while reviewing

Keyboard Shortcuts

ShortcutAction
RRefresh logs
EExport current view
FFocus search field
/Open filter panel
EscClear filters
J / KNavigate rows (down/up)
EnterView event details

Event Details Panel

Click any event row to expand details:

{
"id": "audit_abc123def456",
"timestamp": "2024-01-15T14:32:15.234Z",
"eventType": "config.profile_updated",
"actor": {
"uid": "user_xyz789",
"email": "admin@company.com",
"role": "admin"
},
"target": {
"type": "profile",
"id": "profile_abc",
"name": "Entrance Security"
},
"changes": {
"previousValue": {
"trigger": { "type": "Motion", "sensitivity": 50 }
},
"newValue": {
"trigger": { "type": "Object", "sensitivity": 70 }
}
},
"context": {
"ipAddress": "192.168.1.100",
"userAgent": "Mozilla/5.0...",
"correlationId": "req_456abc",
"source": "ui"
},
"anomalies": []
}

Event Types

Authentication Events

Event TypeDescriptionLogged Data
auth.loginSuccessful loginUser, IP, method, MFA used
auth.logoutUser logged outUser, session duration
auth.login_failedFailed login attemptEmail attempted, IP, reason
auth.mfa_challengeMFA verification requestedUser, method
auth.mfa_successMFA verification passedUser, method
auth.mfa_failedMFA verification failedUser, method, attempts
auth.password_resetPassword reset initiatedUser email
auth.password_changedPassword successfully changedUser
auth.session_expiredSession timed outUser, idle duration
auth.token_refreshedAuth token renewedUser

User Management Events

Event TypeDescriptionLogged Data
user.createdNew user account createdEmail, initial role, created by
user.role_changedUser role modifiedPrevious role, new role, changed by
user.enabledUser account enabledUser, enabled by
user.disabledUser account disabledUser, disabled by, reason
user.deletedUser account deletedUser email, deleted by
user.mfa_resetMFA enrollment resetUser, reset by
user.group_access_changedGroup permissions modifiedGroups added/removed
user.api_key_createdAPI key generatedUser, key prefix, expiry
user.api_key_revokedAPI key revokedUser, key prefix, revoked by

Device Operations Events

Event TypeDescriptionLogged Data
device.registeredNew device connectedSerial, model, IP
device.approvedDevice approved for useDevice ID, approved by
device.rejectedDevice approval rejectedDevice ID, rejected by, reason
device.pausedDevice temporarily disabledDevice ID, paused by
device.resumedDevice re-enabledDevice ID, resumed by
device.retiredDevice permanently removedDevice ID, retired by
device.config_pushedConfiguration sent to deviceDevice ID, config version
device.firmware_updatedFirmware update initiatedDevice ID, from/to version
device.certificate_rotatedDevice certificate renewedDevice ID
device.connection_lostDevice went offlineDevice ID, last seen
device.connection_restoredDevice came back onlineDevice ID, offline duration
device.errorDevice reported errorDevice ID, error code, message

Configuration Events

Event TypeDescriptionLogged Data
config.profile_createdNew profile createdProfile name, group, created by
config.profile_updatedProfile configuration changedProfile ID, changes diff
config.profile_deletedProfile removedProfile ID, deleted by
config.profile_enabledProfile activatedProfile ID, enabled by
config.profile_disabledProfile deactivatedProfile ID, disabled by
config.skill_createdNew skill createdSkill name, type, created by
config.skill_updatedSkill configuration changedSkill ID, changes diff
config.skill_deletedSkill removedSkill ID, deleted by
config.group_createdNew group createdGroup name, created by
config.group_updatedGroup configuration changedGroup ID, changes diff
config.group_deletedGroup removedGroup ID, deleted by
config.webhook_createdWebhook endpoint addedURL (sanitized), events, created by
config.webhook_updatedWebhook configuration changedWebhook ID, changes
config.webhook_deletedWebhook removedWebhook ID, deleted by
config.integration_enabledThird-party integration enabledIntegration type, configured by
config.integration_disabledIntegration disabledIntegration type, disabled by

System Events

Event TypeDescriptionLogged Data
system.maintenance_startedMaintenance mode enabledEnabled by, reason
system.maintenance_endedMaintenance mode disabledDisabled by, duration
system.backup_startedBackup process initiatedBackup type, initiated by
system.backup_completedBackup successfully finishedBackup size, duration
system.backup_failedBackup process failedError message
system.restore_startedRestore process initiatedBackup ID, initiated by
system.restore_completedRestore successfully finishedItems restored
system.export_requestedData export requestedExport type, requested by
system.export_completedData export readyExport size, format
system.health_degradedSystem health issue detectedComponent, severity
system.health_restoredSystem health recoveredComponent, downtime
system.rate_limit_exceededAPI rate limit hitUser/IP, endpoint, limit

Anomaly Detection

Anava automatically analyzes audit events to identify potentially suspicious activity. Anomalies are flagged with severity levels and surfaced in the Audit Log Viewer.

Anomaly Detection Process

Audit anomaly detection flow with severity routing

Anomaly Types and Severity

Low Severity

AnomalyTrigger ConditionRecommended Action
Off-Hours ActivityAction performed outside business hours (configurable)Review for legitimacy; may be normal for remote workers

Medium Severity

AnomalyTrigger ConditionRecommended Action
New IP AddressFirst login from an IP not previously seen for this userVerify with user; may indicate travel or new location
Bulk OperationsMore than 10 similar actions within 1 minuteReview for accidental or malicious mass changes
Geographic AnomalyLogin from location far from usual (>500km)Verify with user; consider MFA re-verification

High Severity

AnomalyTrigger ConditionRecommended Action
Sensitive ActionModification to security settings, user roles, or system configReview immediately; ensure authorized change
Brute Force Attempt5+ failed login attempts for same account within 5 minutesAccount may be under attack; consider lockout
Privilege EscalationUser role elevated to higher privilege levelVerify authorization; check who approved
Unusual Data ExportLarge data export or export to new destinationVerify business need; check for data exfiltration
After-Hours Admin ActionAdmin operations outside business hoursHigh-risk actions should be during business hours

Critical Severity

AnomalyTrigger ConditionRecommended Action
Session HijackingSession used from different IP/device than original loginImmediately terminate session; force password reset
Impossible TravelLogins from distant locations within impossible timeframeAccount likely compromised; lock immediately
Mass Device OperationsBulk device retirement or rejectionPotential sabotage; halt and investigate
Security Control DisabledMFA requirement disabled or security feature turned offEscalate immediately; may indicate insider threat

Anomaly Response Workflow

When anomalies are detected:

  1. Automatic Actions (configurable)

    • Send email notification to security team
    • Trigger webhook to SIEM
    • Log to dedicated security stream
  2. Review Process

    • Filter Audit Log Viewer by severity
    • Expand event to see full context
    • Mark as "Reviewed" or "Escalate"
  3. Resolution Tracking

    • Add notes to anomaly record
    • Link to incident ticket if created
    • Track time to resolution

Configuring Anomaly Detection

Navigate to Admin > Settings > Security > Anomaly Detection:

SettingDefaultDescription
Business Hours08:00-18:00Define normal operating hours
Business DaysMon-FriDefine normal operating days
TimezoneAccount timezoneTimezone for hour calculations
Bulk Threshold10 actions/minuteThreshold for bulk operation flag
Failed Login Threshold5 attempts/5 minThreshold for brute force flag
New IP AlertEnabledAlert on first login from new IP
Geographic Radius500 kmDistance threshold for geo anomaly

Compliance Reports

SOC 2 User Access Review

Generate quarterly user access reviews required for SOC 2 compliance:

Via Admin UI:

  1. Navigate to Admin > Audit Logs
  2. Click Reports > User Access Review
  3. Select review period (last quarter)
  4. Click Generate Report

Report Contents:

SectionInformation
Active UsersAll users with access during period
Role DistributionCount by role (Admin, Operator, Viewer)
Role ChangesAll role modifications with approver
Access AdditionsNew users added
Access RemovalsUsers removed or disabled
Privileged AccessAdmin account activity summary
AnomaliesSecurity anomalies during period

Year-Long Reports via BigQuery

For compliance audits requiring 365-day lookback, query BigQuery directly:

-- All authentication events in past year
SELECT
timestamp,
JSON_VALUE(payload, '$.actor.email') as user_email,
JSON_VALUE(payload, '$.eventType') as event_type,
JSON_VALUE(payload, '$.context.ipAddress') as ip_address
FROM `project-id.anava_audit_logs.audit_events`
WHERE timestamp > TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 365 DAY)
AND JSON_VALUE(payload, '$.eventType') LIKE 'auth.%'
ORDER BY timestamp DESC;

-- Role changes audit trail
SELECT
timestamp,
JSON_VALUE(payload, '$.actor.email') as changed_by,
JSON_VALUE(payload, '$.target.email') as user_affected,
JSON_VALUE(payload, '$.changes.previousValue.role') as old_role,
JSON_VALUE(payload, '$.changes.newValue.role') as new_role
FROM `project-id.anava_audit_logs.audit_events`
WHERE JSON_VALUE(payload, '$.eventType') = 'user.role_changed'
AND timestamp > TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 365 DAY)
ORDER BY timestamp DESC;

-- Device approval audit
SELECT
timestamp,
JSON_VALUE(payload, '$.actor.email') as approved_by,
JSON_VALUE(payload, '$.target.id') as device_id,
JSON_VALUE(payload, '$.target.serial') as serial_number,
JSON_VALUE(payload, '$.eventType') as action
FROM `project-id.anava_audit_logs.audit_events`
WHERE JSON_VALUE(payload, '$.eventType') IN ('device.approved', 'device.rejected')
AND timestamp > TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 365 DAY)
ORDER BY timestamp DESC;

-- Security anomalies summary
SELECT
DATE(timestamp) as date,
JSON_VALUE(anomaly, '$.type') as anomaly_type,
JSON_VALUE(anomaly, '$.severity') as severity,
COUNT(*) as count
FROM `project-id.anava_audit_logs.audit_events`,
UNNEST(JSON_QUERY_ARRAY(payload, '$.anomalies')) as anomaly
WHERE timestamp > TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 365 DAY)
GROUP BY date, anomaly_type, severity
ORDER BY date DESC, count DESC;

Export Capabilities

Supported Export Formats:

FormatBest ForMax Records
CSVSpreadsheet analysis100,000
JSONProgrammatic processing100,000
PDFFormal reports10,000

Scheduled Exports:

Configure automatic exports for compliance:

  1. Navigate to Admin > Settings > Audit > Scheduled Exports
  2. Click Add Export Schedule
  3. Configure:
    • Frequency: Daily, Weekly, Monthly
    • Format: CSV, JSON
    • Destination: Email, Cloud Storage
    • Filters: Event types, severity levels
  4. Save schedule

Compliance Report Templates

Pre-built templates for common compliance needs:

TemplateFrameworkContents
User Access ReviewSOC 2, ISO 27001User lifecycle, role changes, access patterns
Privileged Access LogPCI DSS, SOC 2All admin actions, elevated operations
Authentication SummaryAll frameworksLogin patterns, failures, MFA usage
Configuration ChangesSOC 2, ISO 27001All system configuration modifications
Device ManagementCustomDevice lifecycle, approvals, operations
Incident TimelineAll frameworksEvents around specific date/time

Best Practices

Regular Review Cadence

Establish a consistent audit log review schedule:

Review TypeFrequencyFocus AreasReviewer
Daily Security ScanDailyHigh/Critical anomalies, failed loginsSecurity team
Weekly Ops ReviewWeeklyDevice operations, config changesOperations
Monthly Access ReviewMonthlyUser activity, role changesAdmin
Quarterly ComplianceQuarterlyFull access review, generate reportsCompliance

Alert Thresholds

Configure alerts based on your security posture:

Recommended Starting Thresholds:

AlertConditionSeverityNotification
Failed logins> 5 in 5 minutesHighEmail + Slack
New admin userAny creationMediumEmail
Bulk operations> 20 in 1 minuteMediumEmail
After-hours adminAdmin action after hoursHighEmail + SMS
Critical anomalyAny criticalCriticalPagerDuty

Tuning Guidelines:

  1. Start conservative - Lower thresholds initially
  2. Review false positives - Adjust to reduce noise
  3. Document baselines - Know what "normal" looks like
  4. Seasonal adjustments - Account for business cycles

Incident Response Integration

Integrate audit logs with your incident response process:

Webhook Integration:

{
"url": "https://your-siem.example.com/webhook/anava",
"events": ["auth.login_failed", "user.role_changed", "system.*"],
"severity_filter": "medium",
"format": "json",
"headers": {
"Authorization": "Bearer ${WEBHOOK_TOKEN}"
}
}

SIEM Integration Options:

SIEMIntegration Method
SplunkHTTP Event Collector webhook
DatadogLog forwarding via Cloud Logging
ElasticBigQuery connector or webhook
ChronicleCloud Logging export
QRadarSyslog forwarding

Incident Timeline Construction:

When investigating an incident:

  1. Identify pivot point - The event that triggered investigation
  2. Expand time window - Look 24-48 hours before/after
  3. Filter by actor - Focus on involved users
  4. Export timeline - Generate report for incident documentation
  5. Preserve evidence - Export to immutable storage before retention expires

Security Operations Checklist

Daily:

  • Review high/critical anomalies
  • Check failed login patterns
  • Verify no unexpected admin actions

Weekly:

  • Review device operations
  • Check configuration changes
  • Verify webhook delivery success

Monthly:

  • Generate user access report
  • Review and update alert thresholds
  • Check for stale user accounts
  • Validate BigQuery data ingestion

Quarterly:

  • Generate SOC 2 access review report
  • Review anomaly detection configuration
  • Test incident response procedures
  • Verify retention policy compliance

Troubleshooting

Events Not Appearing

Symptom: Actions taken but not showing in Audit Log Viewer

Checklist:

  1. Check timing - Events may have 1-2 second delay
  2. Verify filters - Clear all filters and retry
  3. Check permissions - Ensure admin role
  4. Check event type - Some actions may not be logged
  5. Check Firestore - Verify audit_logs collection is accessible

Missing Historical Data

Symptom: Events older than 90 days not in UI

Resolution: Use BigQuery for historical data:

SELECT * FROM `project.anava_audit_logs.audit_events`
WHERE timestamp < TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 90 DAY)
LIMIT 1000;

Anomaly Detection Not Working

Symptom: Expected anomalies not being flagged

Checklist:

  1. Check configuration - Verify anomaly detection is enabled
  2. Review thresholds - May be set too high
  3. Check business hours - Verify timezone settings
  4. Test with known trigger - Try 6+ rapid failed logins

Export Failures

Symptom: Export times out or produces incomplete data

Solutions:

  • Reduce date range
  • Apply additional filters
  • Use BigQuery for large exports
  • Schedule export during off-peak hours