Skip to main content

Audit Event Reference

Scope

This reference defines the audit event schema used by the Audit Collector service. It covers the event structure, log types, source types, and query parameters for retrieving audit records.

Definitions

TermDescription
Audit EventA recorded event capturing system activity for compliance and forensic analysis
Log TypeCategory of the audit event (e.g., authorization decision, policy change)
Source TypeOrigin of the audit event (e.g., API gateway, policy engine)
Log EntityThe payload containing the event message and additional details

Allowed Values

Log Types

ValueDescription
AUTHORIZATION_DECISIONRecords authorization check results
POLICY_CHANGERecords policy creation, update, or deletion
TENANT_MEMBERSHIPRecords tenant membership changes
ROLE_ASSIGNMENTRecords role assignment or revocation

Source Types

ValueDescription
API_GATEWAYEvent originated from the API gateway
POLICY_ENGINEEvent originated from the policy engine
ADMIN_CONSOLEEvent originated from administrative operations

Used By


Diagram


Audit Event Structure

AuditEntity

The primary audit event record.

FieldTypeDescription
idStringUnique identifier for the audit event
createTimeISO 8601 TimestampWhen the event was recorded
logTypeStringCategory of the event (see Log Types)
sourceTypeStringOrigin of the event (see Source Types)
serviceNameStringName of the service that generated the event
logEntityLogEntityThe event payload

LogEntity

The event payload containing message and details.

FieldTypeDescription
messageStringHuman-readable description of the event
detailsObjectAdditional contextual data as key-value pairs

Query Parameters

When listing audit events, the following query parameters are available:

ParameterTypeDescription
service_nameStringFilter by service name
log_typeStringFilter by log type
log_source_typeStringFilter by source type
pg_offsetIntegerPagination offset
pg_countIntegerNumber of records to return
date_range_minISO 8601 TimestampStart of time range filter
date_range_maxISO 8601 TimestampEnd of time range filter

Minimal Example

Create Audit Event Request

{
"audit": {
"serviceName": "policy-engine",
"logType": "AUTHORIZATION_DECISION",
"sourceType": "POLICY_ENGINE",
"createTime": "2024-03-15T10:30:00Z",
"logEntity": {
"message": "Permission denied for resource access",
"details": {
"subject": "user_42",
"resource": "doc_99",
"action": "write",
"decision": "deny"
}
}
}
}

Create Audit Event Response

{
"success": true,
"error": null,
"audit": {
"id": "aud_a1b2c3d4",
"serviceName": "policy-engine",
"logType": "AUTHORIZATION_DECISION",
"sourceType": "POLICY_ENGINE",
"createTime": "2024-03-15T10:30:00Z",
"logEntity": {
"message": "Permission denied for resource access",
"details": {
"subject": "user_42",
"resource": "doc_99",
"action": "write",
"decision": "deny"
}
}
}
}

List Audits Response

{
"success": true,
"error": null,
"metaData": {
"total": 150,
"pagination": {
"offset": 0,
"count": 50
},
"timeRange": {
"startDate": "2024-03-01T00:00:00Z",
"endDate": "2024-03-15T23:59:59Z"
}
},
"results": [
{
"id": "aud_a1b2c3d4",
"serviceName": "policy-engine",
"logType": "AUTHORIZATION_DECISION",
"sourceType": "POLICY_ENGINE",
"createTime": "2024-03-15T10:30:00Z",
"logEntity": {
"message": "Permission denied for resource access",
"details": {
"subject": "user_42",
"resource": "doc_99"
}
}
}
]
}

Invalid Example

Missing required serviceName field:

{
"audit": {
"logType": "AUTHORIZATION_DECISION",
"logEntity": {
"message": "Some event"
}
}
}

Error Response:

{
"success": false,
"error": "serviceName is required",
"audit": null
}

Notes

  • All timestamps use ISO 8601 format with timezone
  • The details field in logEntity accepts arbitrary key-value pairs for flexible event context
  • Pagination defaults apply when pg_offset and pg_count are not specified
  • Time range filters are inclusive on both ends
warning

Audit events are immutable once created. There is no update or delete operation for compliance integrity.

Next Step

After understanding the audit event schema, configure observability in your deployment using the Observability Overview.