Turqoa Docs

Audit Logs

Turqoa maintains an immutable, append-only audit log of all system events, user actions, and automated decisions. The audit log is a critical component for regulatory compliance, security investigations, and operational accountability.

Audit Log Structure

Every audit record contains a standardized set of fields:

FieldTypeDescription
idUUIDUnique identifier for the audit entry
timestampISO 8601UTC timestamp with millisecond precision
event_typeStringCategory of the event (see Event Types below)
actionStringSpecific action performed
actor_typeEnumuser, system, or integration
actor_idStringUser email, service name, or integration ID
resource_typeStringType of resource affected
resource_idStringUnique ID of the affected resource
detailsJSONAction-specific metadata
ip_addressStringSource IP (for user actions)
session_idStringSession identifier (for user actions)
checksumStringSHA-256 hash for tamper detection

Event Types

Event TypeExamples
authLogin, logout, SSO authentication, failed login attempt
gateTransaction created, approved, rejected, overridden
securityIncident created, acknowledged, resolved, escalated
adminUser created, role changed, configuration updated
systemService started, model deployed, integration connected
droneMission dispatched, completed, aborted

Example Audit Record

{
  "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "timestamp": "2026-03-15T14:32:07.123Z",
  "event_type": "gate",
  "action": "transaction.override.approve",
  "actor_type": "user",
  "actor_id": "jsmith@terminal.example.com",
  "resource_type": "gate_transaction",
  "resource_id": "TXN-2026-0315-00847",
  "details": {
    "original_decision": "rejected",
    "override_reason": "OCR misread container number",
    "corrected_container_number": "MSCU1234567",
    "confidence_score": 0.42
  },
  "ip_address": "10.0.5.23",
  "session_id": "sess_8a7b6c5d4e3f2g1h",
  "checksum": "a1b2c3d4e5f6..."
}

Querying Logs

Via Admin Panel

Navigate to Admin > Audit Logs. Use the filter panel to narrow results:

  • Date range --- Select start and end dates
  • Event type --- Filter by category (auth, gate, security, admin, system)
  • Actor --- Search by user email or system service name
  • Resource --- Search by resource type or ID
  • Action --- Filter by specific action (e.g., transaction.override)

Via API

# Query audit logs with filters
curl -s "https://turqoa.example.com/api/v1/admin/audit-logs" \
  -H "Authorization: Bearer ${ADMIN_TOKEN}" \
  -G \
  --data-urlencode "start=2026-03-01T00:00:00Z" \
  --data-urlencode "end=2026-03-31T23:59:59Z" \
  --data-urlencode "event_type=gate" \
  --data-urlencode "action=transaction.override*" \
  --data-urlencode "limit=100" | jq .

Via CLI

# Recent gate overrides
turqoa admin audit query \
  --event-type gate \
  --action "transaction.override*" \
  --since 7d \
  --format table

# All actions by a specific user
turqoa admin audit query \
  --actor jsmith@terminal.example.com \
  --since 30d \
  --format json

Export Formats

Audit logs can be exported for external analysis, compliance reporting, or legal proceedings.

FormatUse CaseCommand
JSONProgrammatic analysis, SIEM ingestionturqoa admin audit export --format json
CSVSpreadsheet analysis, compliance reportsturqoa admin audit export --format csv
PDFLegal proceedings, regulatory submissionsturqoa admin audit export --format pdf

Scheduled Exports

Configure automatic exports on a recurring schedule:

audit:
  exports:
    - schedule: "0 2 * * *"      # Daily at 2 AM UTC
      format: json
      destination: s3://terminal-audit-bucket/daily/
      retention_days: 365
    - schedule: "0 6 1 * *"      # Monthly on the 1st at 6 AM
      format: pdf
      destination: /mnt/compliance/monthly-reports/
      include_summary: true

Retention Policies

Audit log retention is configurable per event type. Records beyond the retention period are archived (not deleted) to cold storage.

Event TypeDefault Retention (Hot)Archive RetentionRegulatory Minimum
auth180 days7 yearsVaries by jurisdiction
gate365 days7 years180 days (MTSA)
security365 days7 years365 days (MTSA)
admin365 days7 years180 days
system90 days3 yearsNone
drone365 days7 years365 days
audit:
  retention:
    hot_storage_days: 365
    archive_storage_days: 2555   # 7 years
    archive_backend: s3           # s3, azure-blob, gcs, or local
    archive_bucket: terminal-audit-archive
    compression: zstd

Compliance Reporting

Turqoa includes built-in compliance report templates aligned with common port security regulations:

ReportRegulationFrequencyContent
MTSA Access ControlMaritime Transportation Security ActMonthlyGate access logs, denied entries, security incidents
ISPS AuditInternational Ship and Port Facility Security CodeQuarterlySecurity events, drills, system changes
CTPAT ComplianceCustoms-Trade Partnership Against TerrorismAnnualSupply chain security controls, access logs
CustomOrganization-specificConfigurableUser-defined filters and aggregations

Generate a compliance report:

turqoa admin reports generate \
  --template mtsa-access-control \
  --period 2026-03 \
  --output /reports/mtsa-march-2026.pdf

Note: Audit logs are cryptographically chained using SHA-256 checksums. Each record's checksum includes the previous record's checksum, creating a tamper-evident chain. Any modification to historical records is detectable through checksum verification.