# Investigate a production incident with AI

For administrators, DevOps engineers, SREs and support engineers: something is wrong in production - slow requests,
errors, a restart nobody planned. This page shows how you and an AI assistant use TKTail to find out exactly what
happened, keep the evidence before the logs rotate, and leave a record the next shift can rely on. You do not need to
know how the assistant connects to TKTail; [AI assistance](https://tktail.dev/help/ai-assistance/#quick-start) has the five-minute setup.
The overview for operations teams: [AI-assisted investigation - For Operations](https://tktail.dev/ai/#operations);
what moving the work into TKTail saves, measured: [what an AI assistant receives](https://tktail.dev/performance/competitive/#cmp-payload).

## Why investigate through TKTail

Without a structured tool, an assistant investigates with what a shell gives it: copies of whole log files, ad-hoc
PowerShell pipelines, temporary files, the same searches run again, evidence copied by hand and conclusions that live
only in one chat. Through TKTail the whole investigation stays in one model:

| Instead of | The assistant asks TKTail to |
|---|---|
| reading a 1 GB log into the conversation | search it there - text, fields, numbers, a time range - and send back what matched |
| counting and grouping thousands of lines itself | count, group, rank (top N) and histogram every match, and send back the summary |
| opening Event Viewer, Task Manager and three logs side by side | read the open logs, event logs and Metrics for the same minutes, on one time scale |
| copying the whole log "as evidence" | save only the records that matter, with their context, redacted, verifiable |
| a conclusion that ends with the chat | a note in the evidence package and the incident, which the next person or assistant reads |

TKTail does the work where the records are; the assistant gets small, structured answers that name their sources.

## Case study: slow requests after a restart

A synthetic case built from the shape of a real production investigation (names, addresses and accounts are invented).

**Symptoms.** Shortly after 14:20 UTC users report slow pages and errors on the orders service.

**Available data.** Open in TKTail: the IIS log of the day (`u_ex261107.log`, UTC times) and the service's application
log (`orders-2026-11-07.log`, local times). TKTail compares both on one time scale. If you also open the System or
Application event log, and collect Metrics (Trial / Pro), the assistant reads those for the same minutes too.

**The investigation.** You ask; the assistant chooses the searches; every answer names its source, line and time.

| You ask | What the assistant learns through TKTail |
|---|---|
| *"What happened between 14:20 and 14:25 UTC?"* | 5xx responses per minute from IIS: 35 × 503 from 14:21:58 to 14:22:05, then 130 × 500 until 14:24:29 - and nothing before 14:21:58 |
| *"Was the service restarted around the first failure?"* | the application log: *Service stopping (restart requested by deployment)* at 14:21:58, *Service started (version 4.18.2)* at 14:22:06 - the 503s are the restart itself |
| *"Find all requests slower than 5 seconds."* | 208 requests with `time-taken` of 5,000 ms or more, all on `/api/orders` paths, all after the restart |
| *"Correlate these errors with the IIS requests."* | the application log's 130 *upstream timeout* errors match the 130 HTTP 500s one to one - the same count and the same durations |
| *"Which accounts generated the most failures?"* | the accounts in those errors, ranked by TKTail: ACME-0042 57, GLOBEX-0007 32, then a long tail |
| *"Why were requests slow after the restart?"* | 40 *connection pool exhausted (50 of 50 in use)* warnings from 14:22 to 14:24:30, beside the timeouts: every worker reconnected at once |
| *"Anything else in that hour?"* | 50 failed logins (HTTP 401) at 14:31 from one client address, 203.0.113.77, against one account - not part of this incident |
| *"Check whether Windows recorded any service or application errors."* (System / Application open) | the events of those minutes, next to the log records |
| *"Show CPU, memory and disk around 14:22."* (Trial / Pro, Metrics collected then) | the counters of those minutes - whether the machine itself was under pressure |

**Findings.** The deployment restarted the service at 14:21:58 (the 503s). After the restart the database connection
pool was exhausted and calls to the inventory service timed out; requests queued, 208 took 5 seconds or more and 130
failed, until about 14:24:30, when response times returned to normal without a rollback. The logs alone do not say
whether the new version or the restart's warm-up was to blame - a good assistant says so and names what to check
next. The failed logins at 14:31 are a separate matter for security review.

This case was run with Claude Code (2.1.302) against TKTail 1.2.0 on the generated data, without step-by-step
instructions: 28 TKTail calls, most answers a few KB, the largest 34 KB - a 200-record sample the assistant asked for;
every figure above equal to the generator's ground truth.

## Preserve the evidence

Logs rotate - under load in minutes. Ask: *"Save the relevant evidence before the log rotates: the timeouts and pool
warnings with 20 records of context, and the restart."* The assistant saves an **evidence package**: only those
records with their context, from both logs, plus event logs of the same minutes if you ask - in one ZIP with a
manifest that names each source file (its identity, not only its name), the exact positions, and a SHA-256 for every
part. Secrets are removed before anything is written: the application log of this case contains a connection string
with a password and an `Authorization: Bearer` token - the package holds markers such as `[REDACTED:bearer-token]`
instead. The package stays valid
after the logs are rotated or deleted ([Saving evidence](https://tktail.dev/help/saving-evidence/)).

Saving evidence needs **Allow AI to save evidence and pin searches**; without it the assistant tells you what to save
and you click **Save as Evidence** in Search Results.

## Leave a record the next shift can use

An investigation should end with durable evidence and durable knowledge, not only an answer in one AI conversation.
In this release the record is:

| What | Where | Who |
|---|---|---|
| the conclusion, in words | the evidence package's **note** (*"Restart at 14:21:58 by deployment; reconnect storm exhausted the DB pool until 14:24:30; 14:31 failed logins unrelated"*) | the assistant, when it saves the package, or you |
| the records that prove it | the evidence package - redacted, hashed, its sources and positions named | the assistant or you |
| the incident an alert raised | the Incidents view: the triggering record, the records around it, events and counters of those minutes; the package can be linked to it | TKTail, when an alert fires |
| "reviewed" | **Acknowledge** on the incident | you, in the Incidents view |

**Handover.** Engineer B starts the next shift - or a new assistant session starts tomorrow. They ask: *"What did the
earlier investigation of the orders service conclude, and what evidence supports it?"* The assistant lists the
evidence packages, reads the note, the sources, the time range and the records, and verifies the package - it does not
repeat the investigation. In the run of this case, a new Claude Code session gave the timeline, the cause, the open
question and the side finding of the first session from its two packages and pinned searches, verified both packages
as VALID, and used 15 TKTail calls. The knowledge lives in TKTail's Evidence Library and incident history, not in an assistant's memory.

Not in this release: notes or tags on an incident itself, acknowledging through an assistant, maintenance windows for
planned restarts and named reference points such as "deploy 14:30". Until then, write the conclusion into the evidence
package's note and acknowledge the incidents yourself.

## After a deployment

To check a deployment, ask about the time since it: *"List the incidents of every alert since 14:22, and compare with
the hour before."*, *"Search the orders log since 14:22 for errors that did not occur before."* Alerts that fired
during the planned restart are incidents like any other - acknowledge them after you reviewed them.

## Questions that work well

- *"What happened between 14:20 and 14:25?"*
- *"Find all requests slower than 5 seconds, grouped by URL."*
- *"Which accounts generated the most failures?"*
- *"Was the service restarted around the first failure?"*
- *"Correlate these errors with the IIS requests."*
- *"Check whether Windows recorded any service or application errors."* (with System / Application open)
- *"Show CPU, memory and disk pressure around this time."* (Trial / Pro, with Metrics collected then)
- *"Save the relevant evidence before the trace log rotates - 20 records of context, and the Application event log."*
- *"Prepare a redacted evidence package for the vendor escalation."*
- *"What did the earlier investigation conclude?"*

## What this workflow needs

| For | Switch (Settings > AI Access (MCP)) |
|---|---|
| reading what is open in TKTail | **Allow AI access (MCP)** |
| logs you have not opened, below folders you approve (Trial / Pro) | **Investigation Roots** |
| saving evidence packages and pinning searches | **Allow AI to save evidence and pin searches** |
| creating an alert for the next time | **Allow AI to manage alerts** |

Everything else - acknowledging and deleting incidents, deleting evidence, adding folders - stays with you
([Permissions](https://tktail.dev/help/ai-assistance/#permissions-and-access-model)).

---

The HTML page: https://tktail.dev/help/ai-production-incident/
