Audit Log
The Storsko audit log is an append-only, tamper-evident record of every significant event in the system. Every capability execution, HITL decision, agent registration, authentication event, and administrative action is written to the audit log. Entries cannot be modified or deleted (subject to GDPR erasure, described below).
Audit Log
The Storsko audit log is an append-only, tamper-evident record of every significant event in the system. Every capability execution, HITL decision, agent registration, authentication event, and administrative action is written to the audit log. Entries cannot be modified or deleted (subject to GDPR erasure, described below).
The audit log is central to Storsko's compliance story: it satisfies the EU AI Act's traceability requirements, supports GDPR data access requests, and provides the evidence trail required for SOC2 audits.
Design: SHA-256 Hash Chain
The audit log uses a hash chain to ensure tamper-evidence. Each log entry contains the SHA-256 hash of the previous entry. This means:
- If any historical entry is modified, all subsequent entries have incorrect
prev_hashvalues - Any external verifier can detect tampering by re-computing the chain
- Entries cannot be silently deleted without breaking the chain
Verifying Chain Integrity
Response:
Chain verification is a read-heavy operation. For large deployments, run it asynchronously on a schedule rather than on every request. The verification endpoint is rate-limited to 1 request per minute per API key.
What Gets Logged
The audit log captures every significant event in the system. Events are categorized by type:
Execution Events
| Event Type | Description |
|---|---|
execution.started | Agent began executing a capability |
execution.completed | Capability execution succeeded |
execution.failed | Capability execution failed (includes error details) |
execution.blocked | Execution blocked by HITL block mode |
HITL Events
| Event Type | Description |
|---|---|
hitl.created | A HITL request was created |
hitl.approved | A human approved the request |
hitl.rejected | A human rejected the request |
hitl.escalated | Request was escalated to a higher authority |
hitl.timed_out | Decision window expired |
Agent Lifecycle Events
| Event Type | Description |
|---|---|
agent.registered | New agent was registered |
agent.updated | Agent fields were modified |
agent.deactivated | Agent was deactivated |
agent.transferred | Agent ownership transferred to another org |
agent.token_refreshed | Agent JWT was refreshed |
Capability Events
| Event Type | Description |
|---|---|
capability.granted | Capability granted to an agent |
capability.revoked | Capability revoked from an agent |
capability.config_updated | HITL mode or other config changed for a capability |
Authentication Events
| Event Type | Description |
|---|---|
auth.root_key_used | Root API key authenticated successfully |
auth.agent_jwt_issued | Agent JWT was issued |
auth.login | Human user logged in (commercial) |
auth.logout | Human user logged out |
auth.failed | Authentication attempt failed |
Administrative Events
| Event Type | Description |
|---|---|
admin.key_rotated | Root API key was rotated |
admin.user_created | New user account created (commercial) |
admin.user_deleted | User account deleted |
gdpr.export_requested | GDPR data export was requested |
gdpr.erasure_executed | GDPR data erasure was executed |
LLM Gateway Events
| Event Type | Description |
|---|---|
llm.request | LLM request sent to provider |
llm.pii_detected | PII was found in LLM request and handled |
llm.provider_error | Upstream LLM provider returned an error |
Log Entry Structure
Example entry — capability execution:
Example entry — HITL approval:
Querying the Audit Log
List Entries
Query Parameters
| Parameter | Type | Description |
|---|---|---|
limit | number | Max entries to return (default: 50, max: 500) |
offset | number | Pagination offset |
event_type | string | Filter by event type (e.g. execution.completed) |
agent_id | string | Filter by agent UUID |
user_id | string | Filter by user UUID |
capability | string | Filter by capability name |
outcome | string | Filter by outcome: success, failure, blocked |
from | string | Start date (ISO 8601) |
to | string | End date (ISO 8601) |
TypeScript SDK
GDPR Export
Under GDPR Article 15 (right of access), data subjects can request a copy of all data held about them. Storsko provides a dedicated export endpoint that compiles all audit log entries related to a specific user.
Export format:
The export covers:
- All login/logout events for this user
- All HITL decisions made by this user
- All administrative actions performed by this user
- All data modifications attributed to this user
The export request itself is logged in the audit log as a `gdpr.export_requested` event. This satisfies GDPR Article 12's transparency requirement.
GDPR Data Erasure
Under GDPR Article 17 (right to erasure), users can request deletion of their personal data.
What Gets Erased
| Data | Action |
|---|---|
| User profile (name, email, avatar) | Deleted from users table |
| Session tokens | Invalidated immediately |
| Keycloak account | Deleted from Keycloak realm (commercial only) |
| Personally identifiable audit metadata | Replaced with [erased] placeholder |
What Is NOT Erased
| Data | Reason |
|---|---|
| Audit log entry hashes | Required for chain integrity |
| Audit log timestamps | Required for temporal ordering and compliance reporting |
| Non-personal event data | e.g., capability names, execution IDs — not personal data |
| Anonymized aggregates | Used for compliance reports and SLA metrics |
The erasure operation replaces PII fields in audit metadata (name, email, IP address) with [erased] while preserving the structural integrity of the hash chain. The event still exists and the chain remains valid.
Erasure is irreversible. Once personal data is erased from audit entries, it cannot be recovered. The `gdpr.erasure_executed` event itself is never erased.
Compliance Use Cases
EU AI Act
The EU AI Act requires that high-risk AI systems maintain logs sufficient to enable post-incident investigation:
- Storsko logs every execution of every capability, including the input summary and outcome
- High-risk agents (
risk_level: "high") have all their executions automatically flagged - The hash chain ensures logs cannot be retroactively altered to cover up incidents
- Audit entries include the HITL decision trail (who approved, when, why)
See Compliance for the full EU AI Act documentation.
SOC2
SOC2 Type II requires evidence of access controls, monitoring, and incident response. The audit log supports:
- CC6.1 (Logical access controls): Every authentication event is logged
- CC6.2 (Privileged access): Admin operations (key rotation, erasure) are logged
- CC7.2 (System monitoring): All agent activity is logged in real time
- CC7.3 (Incident identification): Query audit log to reconstruct any incident
GDPR
| GDPR Requirement | Storsko Feature |
|---|---|
| Article 13/14 (transparency) | Audit log makes processing visible |
| Article 15 (right of access) | GET /api/v1/audit/:user_id/export |
| Article 17 (right to erasure) | DELETE /api/v1/users/:id/data |
| Article 22 (automated decisions) | HITL decisions by humans are logged |
| Article 30 (records of processing) | Audit log serves as processing record |
Retention Policies
Default Retention
By default, audit log entries are retained indefinitely. This is the safest option for compliance.
Configuring Retention
When retention is configured, entries older than the retention period are:
- Exported to cold storage (S3 or GCS) before deletion
- Deleted from the primary database
- The deletion is logged as an
admin.audit_retention_sweepevent
Once entries are swept to cold storage, they are no longer queryable via the API. Ensure you have a process to query cold storage archives if needed for compliance investigations.
EU AI Act Retention Requirement
The EU AI Act requires high-risk AI system logs to be retained for a minimum of 10 years from the date the system was last used. Configure retention accordingly for systems containing high-risk agents:
Related Pages
- Authentication — auth events are logged
- Capabilities — every capability execution is logged
- Human-in-the-Loop — HITL decisions are logged
- Compliance — GDPR export, erasure, EU AI Act details