Skip to main content

Configure audit logging

Audit logging records the changes people make in AI Workspace. Each record shows who made the change, what changed, and when. The Platform API stores every record in its database and can also send it to your log pipeline.

Availability

Audit logging is available from update level 1.0.0.7 onwards.

Turn on audit logging​

On VMs​

Add the following to configs/config.toml:

[platform_api.audit]
enabled = true
outputs = ["stdout"]

Then recreate the Platform API container:

docker compose up -d --force-recreate platform-api

On Kubernetes and OpenShift​

Add the following to your values file:

platform-api:
config:
audit:
enabled: true
outputs: ["stdout"]

Apply it with the same helm upgrade --install command you used to install the chart, as in Deploy on Kubernetes.

From now on, each change made in AI Workspace adds a record to the audit table in the Platform API database. Each record also appears as a JSON line in the Platform API log.

Configuration​

Set these parameters under [platform_api.audit] in config.toml, or under platform-api.config.audit in your Helm values.

ParameterHelm valueDefaultDescription
enabledenabledfalseRecords changes.
outputsoutputs[]Where to send each record, in addition to the audit table. Use any of these:
"stdout": the Platform API container log
"file": a log file. See Send records to a file.
"http": your log receiver. See Send records to a log receiver.
mask_sensitive_fieldsmaskSensitiveFieldsfalseShows **** in place of the user in the outputs. The audit table is never masked.

Audit logging never blocks a change. If a record can't be sent to an output, the change still goes ahead and the record stays in the audit table.

What is recorded​

A record is written each time one of these changes succeeds:

ResourceresourceTypeActions
OrganizationsorganizationCREATE
ProjectsprojectCREATE, UPDATE, DELETE
AI gatewaysgatewayCREATE, UPDATE, DELETE
Gateway tokensgateway_tokenCREATE, REVOKE
Custom gateway policiescustom_policyCREATE, DELETE
LLM provider templatesllm_provider_templateCREATE, UPDATE
LLM providersllm_providerCREATE, UPDATE, DELETE
App LLM proxiesllm_proxyCREATE, UPDATE, DELETE
MCP proxiesmcp_proxyCREATE, UPDATE, DELETE
Deployments to a gatewaydeploymentDEPLOY, UNDEPLOY, RESTORE, DELETE
ApplicationsapplicationCREATE, UPDATE, DELETE
API keysapi_keyCREATE, UPDATE, REVOKE
SecretssecretCREATE, UPDATE

Viewing a resource isn't recorded.

The audit record​

Each output receives one JSON line per change:

{
"time": "2026-11-09T06:46:57.126787Z",
"logType": "audit",
"id": "18d3226b-7f3b-4a19-836c-273382b8c253",
"action": "CREATE",
"resourceType": "llm_provider",
"resourceId": "01a1aa75-eb65-7c5d-9a1e-3f0c2b7d8e41",
"organizationId": "7f4a2c9e-1b3d-4e5f-8a6b-9c0d1e2f3a4b",
"performedBy": "[email protected]"
}
FieldDescription
timeWhen the change was made, in UTC.
logTypeAlways "audit". Use it to route audit lines separately from other log lines.
idUnique ID of the record.
actionWhat was done. See What is recorded.
resourceTypeThe kind of resource that changed.
resourceIdThe ID of the resource.
organizationIdThe ID of the organization the resource belongs to.
performedByThe user who made the change. Shows deleted_user if that user has since been deleted.

Send records to a file​

[platform_api.audit]
enabled = true
outputs = ["file"]

[platform_api.audit.file]
path = "/app/data/logs/audit.log"
max_size_mb = 100
ParameterHelm valueDefaultDescription
pathfile.path—Required. Absolute path of the log file.
max_size_mbfile.maxSizeMb100When the file reaches this size, the Platform API renames it to <path>.1 and starts a new file.

On VMs, use a path under /app/data so the file is kept when the container restarts. On Kubernetes and OpenShift, the path must be under /var/log/wso2, as described in Kubernetes and OpenShift.

If you run more than one Platform API replica, give each replica its own file.

Send records to a log receiver​

The Platform API sends records in batches, as newline-delimited JSON, and retries batches that fail. This format works as it is with Splunk HTTP Event Collector (HEC) on its /services/collector/raw endpoint and with Vector. For the Fluent Bit HTTP input, set content_type to "application/json".

Don't write a credential into config.toml. Store it in a file and reference it with a {{ file }} token, as described in Configuration and environment interpolation. On VMs, mount the file read-only under /secrets/platform-api:

services:
platform-api:
volumes:
- ./secrets/audit_http_token:/secrets/platform-api/audit_http_token:ro
[platform_api.audit]
enabled = true
outputs = ["http"]

[platform_api.audit.http]
endpoint = "https://logs.example.com/ingest"

[platform_api.audit.http.auth]
type = "bearer"

[platform_api.audit.http.auth.bearer]
token = '{{ file "/secrets/platform-api/audit_http_token" }}'
ParameterHelm valueDescription
endpointhttp.endpointRequired. The receiver's URL. It must use https:// unless you set allow_insecure_transport.
auth.typehttp.auth.typeOne of these:
"none": no authentication. This is the default.
"bearer": set auth.bearer.token.
"basic": set auth.basic.username and auth.basic.password.
"header": set auth.header.name and auth.header.value.
content_typehttp.contentTypeThe Content-Type header sent with each batch. The default is "application/x-ndjson".
tls.ca_filehttp.tls.caFileA CA certificate (PEM) to verify the receiver. Leave it out to use the system's trusted CAs.
tls.cert_file, tls.key_filehttp.tls.certFile, http.tls.keyFileThe client certificate and key (PEM), if the receiver requires mutual TLS.
allow_insecure_transporthttp.allowInsecureTransportSet it to true to allow a plain http:// endpoint. Use it only for a collector on a trusted network.

Kubernetes and OpenShift​

Store the receiver's credential in a Secret:

kubectl -n <namespace> create secret generic platform-api-audit-http-token \
--from-literal=token=<token>

Then pass the Secret to the Platform API as an environment variable, and reference the variable with an {{ env }} token:

platform-api:
deployment:
extraEnv:
- name: APIP_CP_AUDIT_HTTP_TOKEN
valueFrom:
secretKeyRef:
name: platform-api-audit-http-token
key: token
config:
audit:
enabled: true
outputs: ["stdout", "file", "http"]
file:
path: /var/log/wso2/audit/audit.log
http:
endpoint: https://logs.example.com/ingest
auth:
type: bearer
bearer:
token: '{{ env "APIP_CP_AUDIT_HTTP_TOKEN" }}'

The chart refuses a credential written as a literal value, because the Platform API configuration is stored in a ConfigMap.

For the file output, the chart mounts a volume at /var/log/wso2. Each pod has its own volume, and the volume is emptied when the pod is replaced. To keep the file's records, collect the file with a log shipper, or also use the stdout or http output.

Troubleshooting​

SymptomFix
Records are in the audit table but not in the logs.Add an output to outputs.
The Platform API doesn't start after you change the audit configuration.The startup error names the setting to fix, such as a missing file.path or endpoint, or a credential file that isn't mounted.
helm upgrade fails with holds a literal value.Reference the credential with an {{ env }} token, as shown in Kubernetes and OpenShift.
Records don't reach the log receiver.Look for Failed to deliver audit records in the Platform API log. The message includes the reason, such as the HTTP status.
performedBy shows ****.mask_sensitive_fields is true. The audit table still identifies the user.

Was this page helpful?