Chapter 6. Audit logging and tracing
Configure compliance audit logging for Red Hat OpenShift Lightspeed to produce a durable, reconstructable record of AI actions. Audit logging supports regulatory requirements such as the EU AI Act by capturing who asked what, what the AI proposed, who approved it, and what the system executed. Audit logging is enabled by default on both OpenShift Lightspeed and agentic OpenShift Lightspeed.
6.1. About compliance audit logging Copy linkLink copied to clipboard!
OpenShift Lightspeed provides compliance audit logging to create a durable, reconstructable record of all AI actions across the system. This audit trail supports regulatory requirements such as the EU AI Act. The system captures every significant AI action: who asked what, what the AI proposed, who approved it, and what the system executed.
Audit logging is enabled by default on both OpenShift Lightspeed and agentic OpenShift Lightspeed. You configure audit behavior independently on each component through the spec.audit field of the OLSConfig and AgenticOLSConfig custom resources (CRs).
Dual-emission designThe system emits every audit event in two formats simultaneously:
- Structured JSON to stdout — Always active. Your cluster log aggregation stack collects these entries from pod logs. JSON output is available even when no OpenTelemetry endpoint is configured.
- OpenTelemetry (OTEL) spans — Active when you configure an OTEL collector endpoint. When no endpoint is configured, the system uses a no-op exporter and continues operating normally.
This dual-emission design ensures that audit records are available regardless of whether an OTEL backend is configured.
Trace identifierEvery audit event carries a
trace_idfield that links all log lines and OTEL spans belonging to the same interaction:-
For OpenShift Lightspeed Q&A and troubleshooting interactions: the
trace_idis derived from theconversation_idwith hyphens removed. -
For agentic OpenShift Lightspeed operations: the
trace_idis derived from theAgenticRunresourcemetadata.uidwith hyphens removed.
-
For OpenShift Lightspeed Q&A and troubleshooting interactions: the
The trace_id doubles as the OTEL trace ID, so you can correlate structured log output with distributed traces in your observability platform.
OpenTelemetry GenAI semantic conventions-
OpenShift Lightspeed telemetry—traces, metrics, and structured logs—aligns with the OpenTelemetry GenAI semantic conventions, version 1.41. This alignment applies to both the agentic system, which comprises the agentic operator and sandbox, and the OpenShift Lightspeed service (
lightspeed-service). Standardized telemetry lets you interpret OpenShift Lightspeed traces, metrics, and logs with common OpenTelemetry tooling.
Traces
- The agentic system emits a separate trace for each phase of an operation, rather than a single trace for the entire operation lifecycle. The OpenShift Lightspeed service emits a separate trace for each request.
-
Spans follow GenAI naming conventions, such as
chat <model>for a model interaction andexecute_tool <name>for a tool call, and carrygen_ai.*attributes. -
Span kinds reflect the type of work:
CLIENTfor calls to the large language model (LLM) andINTERNALfor agent framework operations. -
OpenShift Lightspeed distinguishes the requested model from the responding model through the
gen_ai.request.modelandgen_ai.response.modelattributes. -
The
execute_tool <name>span represents any tool call, not only Model Context Protocol (MCP) tools. MCP semantic convention attributes are added only when the tool is MCP-sourced.
Metrics
The system emits gen_ai.* Prometheus histogram metrics. For the agentic sandbox, these are the primary metrics. For the OpenShift Lightspeed service, they are emitted alongside the existing ols_* metrics.
Structured logs
Structured logs use the OTEL JSON format and are written to both stdout and the OTEL log exporter, which can use PostgreSQL as a backend. Each record is emitted through a single path, known as the single-emission rule, to avoid duplicate log entries.
Deferred capabilities
The following capabilities are not yet part of this alignment:
- Content capture controls
- Evaluation events
Cache token attributes
Custom resource serialization-
When an agentic operation completes, the agentic operator serializes the
AgenticRuncustom resource as a compliance record. The serialization captures the full.specand the following metadata fields:name,namespace,creationTimestamp, anduid.
This serialized record is the authoritative compliance artifact for a given autonomous operation. Pod logs from the agentic sandbox and the OpenShift Lightspeed service supplement this record as forensic evidence.
Approver identity injection-
OpenShift Lightspeed injects the approver’s identity into
AgenticRunresources automatically, regardless of the approval path used. A mutating webhook intercepts allPATCHrequests toAgenticRunresources and adds the identity of the authenticated user who submitted the approval. This applies to approvals made through the OpenShift Lightspeed console,kubectl, or the API directly. Audit logging scope- Audit events are captured only in the backend components. The OpenShift Lightspeed console and the agentic console do not emit audit events. All user interactions that affect the audit record are captured by the backend services at the point of receipt and processing.
6.2. How the OpenTelemetry Collector handles audit and trace data Copy linkLink copied to clipboard!
OpenShift Lightspeed integrates with the OpenTelemetry (OTEL) Collector to export audit and distributed trace data to your observability platform. This integration is one half of the dual-emission audit architecture; structured JSON output to stdout is the other half and is always active.
OTEL spans-
Each audit event generates an OTEL span. The span carries the same fields as the corresponding JSON log entry and uses the interaction
trace_idas the OTEL trace ID. This lets you view a complete interaction timeline as a distributed trace in any OTEL-compatible backend such as Jaeger or Tempo. Endpoint configuration-
You configure the OTEL Collector endpoint through the
spec.audit.otel.endpointfield on theOLSConfigorAgenticOLSConfigCR. The endpoint must be a gRPC OTLP address, for example:
spec:
audit:
otel:
endpoint: grpc://otel-collector.observability.svc.cluster.local:4317
You can configure the OTEL endpoint on OLSConfig, AgenticOLSConfig, or both independently.
Graceful degradationConfiguring an OTEL endpoint is optional. When no endpoint is configured:
- The system initializes a no-op OTEL exporter.
- All audit events are still written as structured JSON to stdout.
- The system does not generate errors or warnings due to a missing OTEL endpoint.
You can add or update the OTEL endpoint at any time by editing the CR. The operator reconciles the change without restarting the service.
6.3. Audit log event types Copy linkLink copied to clipboard!
Reference information for the audit events emitted by OpenShift Lightspeed and agentic OpenShift Lightspeed when audit logging is enabled.
6.3.1. Common fields Copy linkLink copied to clipboard!
Every audit log entry contains the following fields, regardless of the event type or component that emits it:
| Field | Type | Description |
|---|---|---|
|
| string | Event type identifier. See the event tables in this topic for valid values. |
|
| string |
Correlation identifier for the interaction. For OpenShift Lightspeed: derived from the |
|
| string (ISO 8601) | Time at which the event occurred, in UTC. |
|
| string | Identifier of the user who initiated the interaction. |
|
| string |
Name of the component that emitted the event, for example |
6.3.2. OpenShift Lightspeed events Copy linkLink copied to clipboard!
The lightspeed-service component emits a separate trace for each Q&A and troubleshooting request. Each trace contains the following spans:
| Span | Description |
|---|---|
|
| The overall request lifecycle. This is the root span for the request. |
|
| Authentication and authorization of the request. |
|
| Retrieval-augmented generation (RAG) context retrieval. |
|
| Conversation history retrieval. |
|
|
Interaction with the large language model (LLM). The span name uses the requested model from the |
|
| A tool call. The tool is named in the span. Model Context Protocol (MCP) semantic convention attributes are added only when the tool is MCP-sourced. |
|
| Persistence of the request and response. |
The following span events are emitted within these spans:
| Span event | Description |
|---|---|
|
| The request was received. Marks the start of an auditable interaction. |
|
| The request completed. Marks the end of the interaction. |
|
| The request failed. |
|
| RAG context was retrieved. |
|
| Conversation history was retrieved. |
|
| Completion or reasoning content returned by the model. When content capture is disabled, this event can be emitted without the completion or reasoning content attributes. |
|
| A tool call was initiated. |
|
| A tool call returned a result. |
|
| A human approval was requested. |
|
| An approval decision was recorded. |
6.3.3. Agentic OpenShift Lightspeed events Copy linkLink copied to clipboard!
Agentic OpenShift Lightspeed emits audit events in two forms, as described by the dual-emission design: structured audit-log entries and OpenTelemetry (OTEL) span events. The two forms use different names for the same underlying event.
6.3.3.1. Agentic OTEL telemetry Copy linkLink copied to clipboard!
The agentic system emits a separate trace for each phase of an operation. The lightspeed-agentic-operator component emits phase span events, and the lightspeed-agentic-sandbox component emits telemetry for the model interactions and tool calls that run within a phase. The following table lists the telemetry emitted in each phase:
| Phase | Operator span events | Sandbox telemetry |
|---|---|---|
| Analysis |
|
|
| Approval |
| None |
| Execution |
|
|
| Verification |
|
|
| Escalation |
|
|
| Terminal |
| None |
In the operator column, agenticrun.* and sandbox.* are span events attached to the phase span, where the sandbox.* events record the operator creating the sandbox resources for the phase. In the sandbox column, chat <model> and execute_tool <tool-name> are spans, and gen_ai.choice is a span event that carries the model completion or reasoning content. When content capture is disabled, the gen_ai.choice event can be emitted without those content attributes.
6.3.3.2. Structured audit-log events Copy linkLink copied to clipboard!
Structured audit-log entries use a distinct set of event names that do not map directly to the span-event names. Examples include audit.agenticrun.received, audit.approval.received, and audit.agenticrun.terminal.
6.3.4. Additional fields for approval events Copy linkLink copied to clipboard!
Approval events include additional fields that identify the approval. The fields differ between the agentic system and the OpenShift Lightspeed service.
Agentic approval events, such as the structured audit.approval.received event and the agenticrun.approval.completed span event, include the following additional fields:
| Field | Type | Description |
|---|---|---|
|
| string |
Unique identifier of the user who approved or rejected the proposal, as injected by the mutating webhook on the |
|
| string |
Username of the user who approved or rejected the proposal, as injected by the mutating webhook on the |
Approval events emitted by the lightspeed-service component include the following additional field:
| Field | Type | Description |
|---|---|---|
|
| string | Identifier of the approval associated with the event. |
6.4. Audit logging configuration reference Copy linkLink copied to clipboard!
Reference information for the spec.audit fields on the OLSConfig and AgenticOLSConfig custom resources.
Both resources expose an identical spec.audit structure. You configure them independently: enabling or disabling audit logging on one does not affect the other.
Audit logging is enabled by default. When the spec.audit field is absent from the CR, audit logging runs as if enabled: true is set. To turn off audit logging, you must explicitly set enabled: false.
6.4.1. spec.audit Copy linkLink copied to clipboard!
| Field | Type | Default | Description |
|---|---|---|---|
|
| boolean |
|
Controls whether audit logging is active. When absent, audit logging is enabled. Set to |
|
| object | — | Optional. OpenTelemetry Collector configuration. When absent, audit events are written as structured JSON to stdout only. |
6.4.2. spec.audit.otel Copy linkLink copied to clipboard!
| Field | Type | Default | Description |
|---|---|---|---|
|
| string | — |
gRPC OTLP endpoint for the OpenTelemetry Collector, for example |
6.4.3. Example: audit logging enabled with OTEL export Copy linkLink copied to clipboard!
The following example enables audit logging and configures an OTEL Collector endpoint on the OLSConfig CR:
apiVersion: ols.openshift.io/v1alpha1
kind: OLSConfig
metadata:
name: cluster
spec:
audit:
enabled: true
otel:
endpoint: grpc://otel-collector.observability.svc.cluster.local:4317
llm:
...
The following example shows the equivalent configuration on the AgenticOLSConfig CR:
apiVersion: ols.openshift.io/v1alpha1
kind: AgenticOLSConfig
metadata:
name: cluster
spec:
audit:
enabled: true
otel:
endpoint: grpc://otel-collector.observability.svc.cluster.local:4317
6.4.4. Example: disable audit logging Copy linkLink copied to clipboard!
The following example disables audit logging on the OLSConfig CR:
apiVersion: ols.openshift.io/v1alpha1
kind: OLSConfig
metadata:
name: cluster
spec:
audit:
enabled: false
llm:
...
6.5. Configure audit logging and tracing Copy linkLink copied to clipboard!
Configure compliance audit logging for Red Hat OpenShift Lightspeed to produce a durable, reconstructable record of AI actions. This feature supports regulatory requirements such as the EU AI Act by capturing who asked what, what the AI proposed, who approved it, and what the system executed. It is enabled by default on both OpenShift Lightspeed and agentic OpenShift Lightspeed.
Prerequisites
-
You have logged in to the OpenShift Container Platform web console as a user with the
cluster-adminrole. -
You have access to the OpenShift CLI (
oc). - You have installed the OpenShift Lightspeed Operator and deployed the OpenShift Lightspeed service.
Procedure
To disable audit logging for OpenShift Lightspeed, set
spec.audit.enabledtofalsein theOLSConfigCR:spec: audit: enabled: falseImportantDisabling audit logging might violate regulatory compliance requirements. Ensure that disabling audit logs aligns with your organization’s compliance and security policies before proceeding.
To disable audit logging for agentic OpenShift Lightspeed, set
spec.audit.enabledtofalsein theAgenticOLSConfigCR:spec: audit: enabled: falseOptional: To export audit events to an OpenTelemetry Collector, add the
spec.audit.otel.endpointfield to the relevant CR. You can configure this onOLSConfig,AgenticOLSConfig, or both, independently:spec: audit: enabled: true otel: endpoint: grpc://otel-collector.observability.svc.cluster.local:4317Apply the updated CR:
$ oc apply -f <cr-file>.yamlExample output:
olsconfig.ols.openshift.io/cluster configured
Verification
To verify that audit events are being emitted for OpenShift Lightspeed, inspect the service pod logs and filter for JSON audit entries:
$ oc logs -n openshift-lightspeed deployment/lightspeed-app-server | grep '"event"'Each audit entry appears as a structured JSON line containing an
eventfield, atrace_id, auser_id, and atimestamp.To verify audit events for agentic OpenShift Lightspeed, inspect the agentic operator logs:
$ oc logs -n openshift-lightspeed deployment/lightspeed-agentic-operator | grep '"event"'