OpenTelemetry (OTLP)
Connect Claude Code, Codex and any OpenTelemetry Collector to Safeguard. The ingest token each exporter needs, which settings work, and step-by-step setup.
Availability
This integration is switched on per workspace. If you do not see the card under Integrations, ask your Safeguard contact.
What it does
Safeguard receives OpenTelemetry logs, metrics and traces over OTLP/HTTP from your own exporters: Claude Code, OpenAI Codex, or any OpenTelemetry Collector. Telemetry from Claude Code and Codex becomes AI agent events, AI Detection & Response (AIDR) detections in Detection & Response, and events in Security Operations. Telemetry from other sources is kept as generic telemetry when the token's policy allows it. The card is OpenTelemetry (OTLP) on the Project/Product tab of Integrations.
Public vs private
| Public | Private | |
|---|---|---|
| What you enter | Nothing; there is no public mode | An ingest token in each exporter's headers |
| Credential needed | None | A Safeguard ingest token (sg_otlp_...) |
| What you can send | Nothing | Logs, metrics and traces from your exporters |
Supported auth methods
| Method | Use it when | Notes |
|---|---|---|
Ingest token in Authorization: Bearer <token> | Recommended default for every exporter | The standard OTLP headers setting carries it |
Ingest token in x-safeguard-ingest-token: <token> | Your exporter already uses Authorization for something else | Same token, different header |
OTLP over HTTP only (http/protobuf or http/json, gzip accepted). OTLP over gRPC is not offered: it needs HTTP/2 end to end, and Safeguard's public edge answers HTTP/1.1. Set your exporter's protocol to http/protobuf (or http/json), never grpc.
Permissions required
Safeguard issues the credential, so there is nothing to grant in a vendor account. The ingest token only lets an exporter send telemetry to your workspace; it cannot read anything back. Least privilege: issue one token per fleet or team, so you can revoke one group without touching the others.
Ingest token
| Permission / scope | Required? | What Safeguard uses it for |
|---|---|---|
Send OTLP logs, metrics and traces to /v1/logs, /v1/metrics, /v1/traces | Required | Accepting telemetry for the workspace (and organization) the token belongs to |
| Keep content (token policy) | Optional | Keeps prompt, tool input and message text, redacted and cut to 2,048 characters; off by default |
| Keep other telemetry (token policy) | Optional | Stores telemetry from sources Safeguard does not map as generic telemetry; on by default |
| Hash identities (token policy) | Optional | Stores a hash of each person's email instead of the email |
Least privilege: one token per group of machines, content kept off, retention as short as your policy allows (30 days by default).
Who can manage tokens in Safeguard
| Permission / scope | Required? | What Safeguard uses it for |
|---|---|---|
| Workspace admin (integration management) | Required | Issuing, rotating, revoking tokens and changing a token's policy |
| Workspace member | Optional | Viewing the token list and what has been received |
Token types
| Token type | Works? | Notes |
|---|---|---|
Safeguard ingest token (sg_otlp_ and 40 characters) | Yes (recommended) | Shown once when issued or rotated; Safeguard stores only its hash |
| Safeguard API keys or sign-in tokens | No | Refused; the receiver accepts ingest tokens only |
| Vendor API keys (Anthropic, OpenAI) | No | Never needed: your exporters send to Safeguard, Safeguard does not call the vendor |
Expiry: ingest tokens do not expire on their own. Rotate them on your normal credential schedule (for example every 90 days) and whenever a machine image or configuration that holds one leaves your control. A workspace can hold up to 50 active tokens.
What we never need: your Anthropic or OpenAI keys, your Claude or ChatGPT account, prompt or tool-detail logging (OTEL_LOG_USER_PROMPTS, OTEL_LOG_TOOL_DETAILS, Codex log_user_prompt), or gRPC.
Step-by-step setup
Create the credential in Safeguard
- Open Integrations, choose the Project/Product tab and click the OpenTelemetry (OTLP) card.
- Under Issue an ingest token, enter a Name (for example "Engineering laptops") and click Issue token.
- Copy the token. Safeguard shows it only once; if it is lost, rotate it.
The endpoint base is https://api.safeguard.sh/gpt/api/v1/otlp. Exporters that take a base URL append /v1/logs, /v1/metrics and /v1/traces themselves.
Claude Code
Set these where Claude Code runs (shell profile, or the env block of Claude Code's settings):
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT=https://api.safeguard.sh/gpt/api/v1/otlp
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer sg_otlp_YOUR_TOKEN"To roll it out to every machine, put the same values in the env block of Claude Code's managed settings:
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://api.safeguard.sh/gpt/api/v1/otlp",
"OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Bearer sg_otlp_YOUR_TOKEN"
}
}Leave OTEL_LOG_USER_PROMPTS, OTEL_LOG_TOOL_DETAILS, OTEL_LOG_ASSISTANT_RESPONSES and OTEL_LOG_TOOL_CONTENT unset unless your policy allows content. Even when they are set, Safeguard drops that content unless the token's Keep content policy is on.
Codex
Add this to ~/.codex/config.toml. Codex sends its events as logs, so the endpoint is the full logs URL:
[otel]
environment = "prod"
log_user_prompt = false
[otel.exporter.otlp-http]
endpoint = "https://api.safeguard.sh/gpt/api/v1/otlp/v1/logs"
protocol = "binary"
[otel.exporter.otlp-http.headers]
"x-safeguard-ingest-token" = "${SAFEGUARD_OTLP_TOKEN}"Then set SAFEGUARD_OTLP_TOKEN to your token in the environment Codex runs in.
Or with an OpenTelemetry Collector
Add an otlp_http exporter (named otlphttp before Collector 0.161; the old name still works) and list it in each pipeline you want to send:
exporters:
otlp_http/safeguard:
endpoint: https://api.safeguard.sh/gpt/api/v1/otlp
encoding: proto
compression: gzip
headers:
Authorization: "Bearer ${env:SAFEGUARD_OTLP_TOKEN}"
service:
pipelines:
logs:
exporters: [otlp_http/safeguard]
metrics:
exporters: [otlp_http/safeguard]
traces:
exporters: [otlp_http/safeguard]Connect it in Safeguard
- Open Integrations, choose the Project/Product tab and click OpenTelemetry (OTLP).
- Issue a token as above. The Set up an exporter tabs (Claude Code, Codex, OTel Collector) show the snippets with the token you just issued.
- Start your exporter. Under Received, Log records, Data points and Spans count up within a minute (Claude Code exports metrics every 60 seconds and logs every 5 seconds by default).
Webhooks and triggers
This integration has no webhooks; your exporters push telemetry as it happens.
What we read and store
- Read: only what your exporters send to the endpoint with your token. Safeguard never connects to Claude, Codex or OpenAI for this integration.
- Stored: AI agent events (session, tool decisions and results, model calls, tokens and cost, sub-agent links), AIDR detections in Detection & Response, Security Operations events, and, when Keep other telemetry is on, generic telemetry with its attributes cut to an allowlist. Kept for the token's retention (30 days by default).
- Redacted on arrival, always: credentials in every kept value, including API keys (Anthropic, OpenAI, AWS, GitHub, GitLab, Slack, Stripe, Google, npm, Safeguard), private keys, bearer tokens, passwords in
key=valuepairs and credentials in URLs. Each becomes[REDACTED:<kind>]. - Not stored: prompt, tool input, response and message content (only their length) unless the token's Keep content policy is on; then it is redacted and cut to 2,048 characters, stored but never searchable. The ingest token itself is stored only as a hash.
- Limits: a request body of up to 4 MiB (16 MiB once decompressed) and 10,000 records; 20 requests a second per token and 60 per workspace. Over a limit, Safeguard answers 413 or 429 with
Retry-After, and OTLP exporters retry on their own. - No customer data from this integration is sent to third-party LLMs.
Troubleshooting
| Message you see | Cause | Fix |
|---|---|---|
An ingest token is required (Authorization: Bearer sg_otlp_...). | The exporter sent no token | Set OTEL_EXPORTER_OTLP_HEADERS, the Codex headers table or the Collector headers |
The ingest token is not valid. | A mistyped or unknown token | Copy the token again, or rotate it and update the exporter |
The ingest token has been revoked. Issue a new one in Integrations. | The token was revoked, or rotated and its grace period ended | Issue or rotate a token and update the exporter |
OTLP ingest is not enabled for this workspace. | The integration is not switched on for your workspace | Ask your Safeguard contact |
Content-Type must be application/x-protobuf or application/json. | The exporter uses gRPC or another encoding | Set the protocol to http/protobuf or http/json |
Unknown signal; use /v1/logs, /v1/metrics or /v1/traces. | The endpoint path is wrong | Use the base URL for Claude Code and the Collector, and the full /v1/logs URL for Codex |
Rate limit reached for this ingest token. | More than 20 requests a second on one token | Nothing; the exporter retries. For large fleets, send through a Collector with batching |
The request body is over 4194304 bytes. | One export is too large | Turn on gzip and lower the exporter's batch size |
The receiver is busy. | Safeguard is shedding load for a moment | Nothing; the exporter retries after Retry-After |
Rotation and disconnect
- Rotate: in the token list click Rotate, set a Grace period (minutes) of up to 60 if the exporters need time to update, and copy the new token into every exporter. The old token stops working when the grace period ends.
- Disconnect: click Revoke on the token. Exporters using it are refused from then on; what was already received stays until its retention ends. Remove the OTLP settings from Claude Code, Codex or the Collector.
Vendor references
- Claude Code: Monitoring (OpenTelemetry), checked 2026-10-16.
- Codex: Advanced configuration, OpenTelemetry, checked 2026-10-16.
- OpenTelemetry Protocol (OTLP) specification, checked 2026-10-16.
- OpenTelemetry Collector OTLP/HTTP exporter, checked 2026-10-16.
Fireworks AI
Connect Fireworks AI to Safeguard. The service account roles the key needs for the inventory and the access tests, and step-by-step setup.
Claude (Anthropic)
Connect your Anthropic organization to Safeguard. The key each feature needs, why Anthropic's Admin keys are full access, and step-by-step setup.