feature request: ability to log/trace the full llm span (query and response)
Status Closed — not planned
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 10 comments · opened Jun 14, 2025 · closed Jan 23, 2026
as far as i can tell from spending half a day trying to figure this out, OTEL_LOG_USER_PROMPTS will log the prompt, but there is no way to log the response from claude.
is this true?
this seems crazy to me, is there a reason why everything but the response itself can be logged with otel? i don't see why it would be a privacy/security issue, since the response is returned to the user.
maybe there is something i'm missing, why is this a "privacy issue"?
10 Comments
playing around with this a little bit more, what i would specifically like to request is a
OTEL_LOG_API_RESPONSESvariable, which would default to false just likeOTEL_LOG_USER_PROMPTS. (feel free to name differently)functionally, this would contain the claude api responses in the same OTEL system as all of the other OTEL logs.
as a user, i can access all of the information separately (for example, see my workaround below) - so again i don't really understand why including the responses in the OTEL logging presents a user privacy or security issue.
---
for others who might also be frustrated by this limitation, right now i'm basically doing a workaround by combining the
claude -poutput with console otel logs.unfortunately this becomes extremely messy if you want to try the interactive REPL (not
-p), so my workaround is probably not immediately relevant to the average user.i make a script like this, then run it with
./script "my prompt"additional breadcrumbs for users in interactive mode: most of what you would want to trace is already being stored in
~/.claude/projects/[project]/[hash].jsonl.again re: claude's statement that this is a "privacy" issue, the logs are already on my machine and saved by default. it just seems annoying to have to write a script to put this into an observability tool, and potentially manually merge this information with the current OTEL implementation.
Yeah. My OpenTelemetry collector received the logs but it's completely useless:
With fields like
cost_usdandoutput_tokens, the log is definitely reported at response phase, yet it omits the actual response. What's the point!?+1 - any update on this?
i've been using this: https://github.com/badlogic/lemmy/tree/main/apps/claude-trace
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Still relevant 🙏
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.