# Give Claude Code the production logs it needs to investigate a bug

> Source: <https://signoz.io/faqs/claude-code-production-logs-debugging>
> Published: 2026-11-23 00:00:00+00:00

**Recommendation:** Give the agent read-only log and trace access plus the deployed commit and explicit UTC incident windows, then require it to cite supporting records and list missing evidence before you act.
More in the playbook "Running AI in production": <https://wpnews.pro/playbooks/production-ops>

# Give Claude Code the production logs it needs to investigate a bug

Claude Code can investigate a failure by querying logs, traces and historical metrics stored in [SigNoz Cloud](https://signoz.io/log-management/), then comparing that evidence with the application code. The connection uses Model Context Protocol (MCP), which gives Claude tools to query the data.

To try this, follow the [Claude Code configuration steps](https://signoz.io/docs/ai/signoz-mcp-server/?client=cloud-claude-code#claude-code) using a read-only service account. Give Claude access to the relevant application code as well, so it can relate what it finds in the logs to the code that produced them. For cloud sessions, see the [Claude Code cloud setup guide](https://code.claude.com/docs/en/claude-code-on-the-web/).

Once connected, adapt this prompt to your service and incident window. Make the deployed source version available in the workspace:

```
Using SigNoz, investigate errors for [service] between [start and end, UTC].
Retrieve relevant logs and related traces where available, then compare
the evidence with the code deployed at [commit or release]. Cite the
records supporting your explanation and identify any missing evidence.
Do not make changes.
```

## Investigate an example failure

For example, we ran a [public Python app](https://github.com/SigNoz/examples/tree/b811d26ab91208d6c3ef884b9497e4f38489737d/fastapi/opentelemetry-fastapi-demo) that deliberately returns a server error (HTTP 500) when called at `/exception`. We sent its logs, traces and metrics to SigNoz Cloud.

We asked Claude to investigate the error using the logs and a failed trace, and to compare request counts before and during the failure. To help it find the right data and code, we gave it the service name, source commit and two time windows in UTC. The first window covered successful requests; the second included requests to `/exception`.

## Check what the agent found

Claude retrieved five error logs containing `ValueError` and linked one to a failed `GET /exception` trace. The logged stack trace pointed to `raise ValueError("sadness")` in the sample, which matched the known failure.

The logs and trace explain an individual failure. To see how it fit into the wider request activity, Claude also compared the request counts for the two periods. Its report showed 10 successful requests in the earlier period, and 10 successes and five failures in the later period.

For your own incident, make sure Claude can access the source version that was deployed and the logs, traces and metrics for the relevant period. Check its explanation against the evidence, and ask it to identify any missing information before you act on it.

See [natural-language log exploration](https://signoz.io/docs/ai/use-cases/natural-language-log-exploration/) for more query examples.
