Skip to main content

G-06 Logs

Brick G of the Enterprise AI Platform. Technology: OpenSearch (Apache-2.0) with structured JSON logs shipped by Grafana Alloy or the OTel Collector filelog receiver, index eai-logs-*. French version: ../../fr/bricks/G-06-logs.md.

Role and responsibilities​

  • Centralize application logs with trace_id, request_id, tenant_id fields; separate from the audit chain.

Position and interactions​

  • Execution path: event stream.
  • OpenSearch Dashboards shows the log lines; the trace_id field links them to the traces (Jaeger and Opik).

Open source and developed parts​

  • Open source reused: OpenSearch, Grafana Alloy or OTel Collector.
  • Developed in the platform: Logging format, redaction filter, retention per environment.

Data model​

Control Plane tables (schema eai): eai.audit_events.

Every tenant table has tenant_id uuid NOT NULL and a row level security policy on current_setting('app.tenant_id', true)::uuid. ClickHouse usage_events is the analytics replica of eai.usage_events (ReplacingMergeTree keyed by event_id).

Contract: contracts/v1/audit-event.schema.json (schema_version 1.0). Usage is always reported with contracts/v1/usage-event.schema.json, audit with contracts/v1/audit-event.schema.json.

API endpoints​

MethodPath
GET/v1/telemetry/overview

GET /v1/telemetry/overview​

Response:

{
"window": "24h",
"requests": 18234,
"error_rate": 0.012,
"p95_latency_ms": 2140,
"tokens": {
"input": 9120044,
"output": 1203400
},
"top_models": [
{
"model_id": "gpt-4o-mini",
"share": 0.61
}
]
}

SDK examples​

Python​

from enterprise_ai import EnterpriseAI

client = EnterpriseAI(base_url="<control-plane-url>", api_key="eai_live_xxx", tenant="acme", locale="en")
client.telemetry.overview(days=1)

TypeScript​

import { EnterpriseAI } from "@enterprise-ai/sdk";

const client = new EnterpriseAI({ baseUrl: "<control-plane-url>", apiKey: process.env.EAI_API_KEY, tenant: "acme", locale: "en" });
await client.telemetry.overview({ days: 1 });

Java​

EnterpriseAIClient client = EnterpriseAIClient.builder()
.baseUrl("<control-plane-url>")
.apiKey(System.getenv("EAI_API_KEY"))
.tenant("acme")
.locale(Locale.ENGLISH)
.build();
client.telemetry().overview(Map.of("days", 1));

Go​

client, err := eai.NewClient(eai.WithBaseURL("<control-plane-url>"), eai.WithAPIKey(os.Getenv("EAI_API_KEY")), eai.WithTenant("acme"), eai.WithLocale("en"))
if err != nil { log.Fatal(err) }
ctx := context.Background()
_, err = client.Telemetry.Overview(ctx, eai.WithQuery(map[string]string{"days": "1"}))

Configuration​

Environment variables: EAI_OTEL_EXPORTER_OTLP_ENDPOINT, EAI_SIEM_SYSLOG_HOST, EAI_SIEM_SYSLOG_PORT.

Helm values keys (deploy/helm/enterprise-ai/values.yaml): controlPlane.config, controlPlane.secrets.

Security​

  • Logs never contain API keys, tokens or raw prompts; a CI test greps for secret patterns.
  • Tenant resolved from the credential, never from the body; PostgreSQL row level security on every tenant table.
  • Every mutation and policy decision writes a hash chained audit event (G-11).
  • Errors use the standard envelope with message_i18n en and fr.

Observability​

  • Ingestion rate per tenant and per namespace.
  • W3C traceparent propagated, X-Request-Id returned, spans carry eai.tenant_id, eai.project, eai.agent_id, eai.run_id.

FinOps units​

  • Log volume per namespace allocated as observability cost.

Failure modes and resilience​

  • OpenSearch down -> local buffer of the agent, logs are not the evidence source (audit is).

Standalone adoption​

Plug into the client's existing OpenSearch or SIEM.

Acceptance tests​

  1. A failed request log line contains request_id and trace_id.

Implementation roadmap