From 24ab5205d2cf76361e7f1c48c74669c76715790a Mon Sep 17 00:00:00 2001 From: "blinkagent[bot]" <237617714+blinkagent[bot]@users.noreply.github.com> Date: Fri, 27 Feb 2026 10:40:59 +0100 Subject: [PATCH] docs: add AI Bridge structured logging section to setup page (#22361) Adds a brief "Structured Logging" section to the [AI Bridge Setup](https://coder.com/docs/ai-coder/ai-bridge/setup) page documenting the `--aibridge-structured-logging` / `CODER_AIBRIDGE_STRUCTURED_LOGGING` flag. Covers: - How to enable structured logging (CLI flag, env var, YAML) - The five `record_type` values emitted (`interception_start`, `interception_end`, `token_usage`, `prompt_usage`, `tool_usage`) and their key fields - How to filter for these records in a logging pipeline Created on behalf of @dannykopping --------- Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com> --- docs/ai-coder/ai-bridge/setup.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/ai-coder/ai-bridge/setup.md b/docs/ai-coder/ai-bridge/setup.md index b56f4eba94..5232331926 100644 --- a/docs/ai-coder/ai-bridge/setup.md +++ b/docs/ai-coder/ai-bridge/setup.md @@ -123,3 +123,31 @@ Set to `0` to retain data indefinitely. For duration formats, how retention works, and best practices, see the [Data Retention](../../admin/setup/data-retention.md) documentation. + +## Structured Logging + +AI Bridge can emit structured logs for every interception record, making it +straightforward to export data to external SIEM or observability platforms. + +Enable with `--aibridge-structured-logging` or `CODER_AIBRIDGE_STRUCTURED_LOGGING`: + +```sh +coder server --aibridge-structured-logging=true +``` + +Or in YAML: + +```yaml +aibridge: + structured_logging: true +``` + +These logs are written to the same output stream as all other `coderd` logs, +using the format configured by +[`--log-human`](../../reference/cli/server.md#--log-human) (default, writes to +stderr) or [`--log-json`](../../reference/cli/server.md#--log-json). For machine +ingestion, set `--log-json` to a file path or `/dev/stderr` so that records are +emitted as JSON. + +Filter for AI Bridge records in your logging pipeline by matching on the +`"interception log"` message.