Skip to main content

Audit events

Talos emits structured audit events via OpenTelemetry span events for all significant lifecycle operations. Events are attached to the active OTEL span and forwarded to any configured OTEL collector. They are never persisted locally.

Each event carries a set of structured attributes that provide context about the operation, the actor, and the affected resource.

Event types

ConstantEvent NameDescription
EventAPIKeyCreatedAPIKeyCreatedEventAPIKeyCreated is emitted when an API key is created (issued or imported).
Use the KeyType attribute to distinguish between the two origins.
EventAPIKeyUpdatedAPIKeyUpdatedEventAPIKeyUpdated is emitted when an API key's metadata is updated.
EventAPIKeyRevokedAPIKeyRevokedEventAPIKeyRevoked is emitted when an API key is revoked.
EventAPIKeyRotatedAPIKeyRotatedEventAPIKeyRotated is emitted when an API key is rotated.
EventAPIKeyVerifiedAPIKeyVerifiedEventAPIKeyVerified is emitted when an API key is successfully verified.
EventAPIKeyVerificationFailedAPIKeyVerificationFailedEventAPIKeyVerificationFailed is emitted when an API key verification fails.
EventAPIKeyImportFailedAPIKeyImportFailedEventAPIKeyImportFailed is emitted when an API key import fails.
EventTokenDerivedTokenDerivedEventTokenDerived is emitted when a session token is derived from an API key.
EventAPIKeyDeletedAPIKeyDeletedEventAPIKeyDeleted is emitted when an issued API key is permanently deleted.
EventImportedAPIKeyDeletedImportedAPIKeyDeletedEventImportedAPIKeyDeleted is emitted when an imported API key is permanently deleted.

Event attributes

Each event carries the following OTEL span event attributes:

OTEL KeyStruct FieldTypeRequiredDescription
``NetworkIDuuid.UUIDRequiredAttrNetworkID uses the shared semconv NID key so the analytics pipeline can route by project.
APIKeyIDKeyIDstringOptionalKey identification (present for key-related events)
APIKeyPrefixPrefixstringOptional
KeyTypeKeyTypestringOptionalKey origin (present for created/rotated events)
OperationOperationstringOptionalOperation context
ReasonReasonstringOptionalFailure reason or additional context
ActorIDActorIDstringOptionalActor information (who performed the operation)
ExpiryExpiry*time.TimeOptionalKey properties (present for create/rotate/update events)
VisibilityVisibilitystringOptional"public" or "secret"
metadata.Metadatamap[string]stringOptionalAdditional context (varies by event type)

Dynamic metadata attributes

The metadata.* prefix supports arbitrary key-value pairs for event-specific context. Metadata keys are prefixed with metadata. in OTEL attributes. For example, a metadata entry {"token_type": "jwt"} becomes the OTEL attribute metadata.token_type with value jwt.

Metadata is optional and varies by event type. Common metadata keys include:

  • token_type — Type of derived token (e.g., jwt, macaroon)
  • previous_key_id — ID of the key being replaced during rotation
  • import_source — Origin of an imported API key

Emitting events

Events are constructed using the fluent builder pattern:

emitter := events.NewOTELEmitter()
events.New(events.EventAPIKeyCreated).
WithNetworkID(networkID).
WithKeyType("issued").
WithKeyID(keyID).
WithPrefix("talos").
WithActor(actorID).
Emit(ctx, emitter)

Events are attached to the active OpenTelemetry span. If no span is recording, the event is silently dropped.