# Cross-reference an issue with server logs

Cross-reference an issue with your own server logs to find the root cause.
Cofactor sees the symptom in the browser; your logs show the cause.

1. Get the evidence from the issue

   ```bash
   cofactor issues get <issueId> --json --include console,network,repro
   ```

   Write down: when it was detected (timestamp), the URL and API routes
   involved, visible error text, failed requests and their HTTP status codes,
   and any request or correlation IDs.

2. Query your logs for the same window

   Use whatever your team uses (CloudWatch, Datadog, kubectl logs, a local log
   file, Sentry). Search a few seconds either side of the detection time,
   filtered by the route and the error text. Cofactor does not hold your server
   logs; ask the user where they live if you do not know.

3. Correlate

   Match on timestamp, error message, HTTP status (4xx/5xx for the failed
   request), URL or route, stack trace, and request ID. A request ID lets you
   follow one request end to end.

4. Report

   - State match confidence: clear, likely, or circumstantial.
   - Lay out a single timeline across the browser evidence and the logs.
   - Separate the symptom (what Cofactor caught) from the cause (what logs show).
   - Point at the specific code, service, or config to fix.
   - Say plainly when logs are missing or incomplete; do not speculate.

5. Record what you found

   ```bash
   cofactor issues create --check ...        # file only if no issue exists
   cofactor issues bump <issueId> --url <url> --log-query "<query>" --log-system cloudwatch
   ```

   Attach the query with `--log-query` (repeatable; `--log-system` is one of
   `sentry`, `cloudwatch`, `datadog`, `other`), and `--sentry <id|url>` and
   `--code-ref <path[:line]>` for a Sentry issue or the defective code location.
