# TKTail - the documentation for AI agents in one file

TKTail version: 1.2.0
Docs version: sha256:3af60c0f9ee6ed855e21705dbd8df9e2a893689d6788aa024bed3fe1a7891758
Generated: 2026-11-07
Canonical origin: https://tktail.dev
Index: https://tktail.dev/llms.txt
AI manifest: https://tktail.dev/ai/manifest.json
AI Agent Harness for TKTail 1.2.0: https://tktail.dev/releases/1.2.0/TKTail-1.2.0-ai-harness.zip

Use the AI Agent Harness that matches the installed TKTail version.
Downloading the AI Agent Harness does not grant an AI assistant access to files, logs, or the operating system.

The TKTail Help (the same guide that ships offline with TKTail.exe): first the pages for AI agents, then the product.
Each page starts with its canonical address. The authority for the tools is the running TKTail itself (tools/list).

---

Source: https://tktail.dev/help/ai-assistance/

# AI assistance

An AI assistant can investigate with TKTail: instead of you pasting log lines into a chat, or the assistant running
ad-hoc commands on your machine, it asks TKTail - and TKTail answers with the parsed records, search results,
summaries, Windows events, metrics, alerts and incidents of what you opened or approved, each answer pointing back to
its evidence. This page is for everyone who wants to work with an assistant this way - administrators, developers,
support engineers. You do not need to know how the connection works to use it; the technical side is in
[AI integration (MCP)](https://tktail.dev/help/mcp/).

TKTail's AI features were shaped by real production investigations: each gap an assistant hit there - answers too
large to send, evidence lost to log rotation, alerts on files that change their name every day - became a feature.

**Two ways people use it** - each a complete walkthrough with a worked example:

- **[Investigate a production incident](https://tktail.dev/help/ai-production-incident/)** - for administrators, DevOps engineers, SREs and
  support: find what happened across logs, events and counters, keep the evidence before the logs rotate, and leave a
  record the next shift can rely on.
- **[Develop with a coding agent](https://tktail.dev/help/ai-developer-loop/)** - for developers with Claude Code or another coding agent:
  after each build and run, the agent reads what the code actually did - errors, slow operations, warnings - and uses
  it for the next change.

## How you and an assistant investigate together

```
VIEW  ->  SEARCH  ->  CORRELATE  ->  UNDERSTAND  ->  PRESERVE  ->  VERIFY  ->  MONITOR
open      text,       event logs,     summaries,      evidence      hashes,     alerts on
logs      fields,     Metrics, the    top N, numbers  packages      sources     the log and
          time        same minutes                    (redacted)    named       its series
```

You open the logs and decide what the assistant may do; the assistant asks TKTail the questions and proposes the next
step; every answer names its evidence, so you can check it in the same window.

## Why an assistant works better through TKTail

- **Structured answers.** A record arrives as a record - its time, its severity, its fields, the whole multi-line
  entry - not as text to be guessed at.
- **Small answers - the work is done where the records are.** TKTail searches, filters, extracts numbers, counts,
  groups and summarizes itself, and sends the result: *the top 10 client addresses of 240,000 errors* is a few
  kilobytes, not 240,000 records the assistant has to receive, read and count. Less data moved, less time, less of the
  assistant's context used.
- **Evidence you can check.** Every result names its source, its line and its time, and carries a reference the
  assistant (or you) can open again in TKTail.
- **Boundaries.** The assistant reads only what is open in TKTail or below folders you approved; it changes nothing
  unless you allowed that kind of change; it cannot run programs or commands.
- **Your view, shared.** The assistant's searches appear in your Search Results, marked **AI**; a file it opens appears
  as a tab.

## What an assistant can do

| Capability | For example |
|---|---|
| Read the record you are on, and what happened before and after it | *"Explain the error I am looking at."* |
| Search open logs and event logs - text, regular expressions, field conditions, time ranges | *"Find every record of request R-41166."* |
| Compare a number in the text | *"Which requests took 1000 ms or longer?"* (`elapsed: 1985.000ms` counts) |
| Summarize what a search found, in TKTail | *"The top 10 client IPs causing 500 errors"*, *"requests per minute"*, *"the average time-taken per URL"* |
| Return only the fields it needs, or just the count | *"How many timeouts were there?"* |
| Find sequences across logs, joined by an ID | *"Did a request fail downstream within 10 seconds?"* |
| Read the Windows events of channels you opened | *"What did the System log say around 22:11?"* |
| Read Metrics TKTail collects (Trial / Pro) | *"What did CPU and memory do in the minute around this error?"* |
| Read your alerts, their incidents and the evidence each kept | *"What happened in the last Payment errors incident?"* |
| Preserve evidence before the logs rotate - only the records found, with their context, redacted | *"Save these 57 results with 20 records of context."* |
| Keep a search for later, across restarts (pin it) | *"Pin that search - we will come back to it."* |
| See whether an alert is alive and which file it reads | *"Is alert 12 running, and which rotated file is it reading?"* |
| Propose and check an alert - and, with your permission, save it | *"Watch this log for payment failures."* |
| Explain a log's format, write a custom format and preview it | *"Why is this log plain text? Write a format for it."* |
| With approved folders (Trial / Pro): list and search logs you have not opened | *"Find the IIS logs of yesterday below D:\Logs."* |

## What an assistant cannot do

Through TKTail an assistant **cannot**: run commands, programs, scripts or PowerShell; start, stop or restart
services; end processes; change firewall rules, IIS, settings or configuration files; delete, move or write files (the
one exception is an evidence package in TKTail's own Evidence Store - redacted, within its size limits; see below);
read a file that is neither open in TKTail nor below a folder you approved; add an approved folder; acknowledge or
delete incidents; delete evidence (it can only ask - you decide in TKTail). TKTail has no tool for these, and no permission turns one on. It does not repair anything by itself:
it investigates and proposes; you decide.

Not available in this release (planned, not shipped): reading configuration files with secrets removed, process,
service, TCP and IIS diagnostics, reading a performance counter TKTail does not already collect, opening a Windows Event
Log channel on its own, testing an alert against past data, alerts on "N matches within a time window", and managing
incidents (acknowledging, notes, maintenance windows). How busy this PC is (CPU, memory) you see yourself in the
bottom panel's **System** view ([System](https://tktail.dev/help/bottom-panel/#system)); an assistant reads the machine's state only through
the Metrics TKTail collects.

## Quick start

1. **Open TKTail** and open what you want to investigate - the logs, the Windows Event Log channels (for example
   System), a Metrics View (Trial / Pro).
2. **Allow AI access**: **Settings > AI Access (MCP) > Allow AI access (MCP)**. TKTail remembers it; turn it off there
   or with **Tools > Allow AI Access (MCP)**.
3. **Connect your assistant.** On the same page, **Copy Client Configuration** copies a ready entry for your assistant.
   With Claude Code: save it as `.mcp.json` in a folder and start `claude` there (details: [AI integration
   (MCP)](https://tktail.dev/help/mcp/#connect-over-stdio)).
4. **Ask something simple**: *"What am I looking at in TKTail?"*
5. **Check the evidence**: the answer names files, lines and times - open them in TKTail; the assistant's searches are
   in Search Results, marked **AI**.
6. **Allow more only when you need it**: folders beyond your open tabs (Investigation Roots), saving searches, alerts or
   formats - each is its own switch ([Permissions](https://tktail.dev/help/ai-assistance/#permissions)).

## Things you can ask

- *"Show me the top 10 client IPs causing errors in the last hour."*
- *"How many requests failed per minute between 10:00 and 11:00?"*
- *"Find requests where elapsed time exceeded 1000 ms, and group them by URL."*
- *"What is the average and the maximum time-taken of the slowest URLs?"*
- *"Which accounts produced the most payment failures today?"*
- *"Did the service log a restart around 22:11, and what did the System event log say then?"* (with System open)
- *"What did CPU and memory do around the first error?"* (Trial / Pro, with a Metrics View open)
- *"Is the Payment errors alert running, and which of the dated files is it reading now?"*
- *"Create an alert for FATAL in the orders log, including the rotated files."* (with your permission)

## A production incident, with an assistant

A synthetic example: an IIS site answers 500 for some clients since 10:05; the application writes an orders log.

1. You open `u_ex261102.log` (the IIS log of the day) and `orders-2026-11-02.log` in TKTail, and the System channel.
2. *"Which clients get server errors, and since when?"* - the assistant searches `sc-status >= 500` and lets TKTail
   summarize every match: the top 10 client addresses with their counts, and a per-minute histogram that starts at
   10:05. It receives a few kilobytes, not 240,000 records.
3. *"Which URLs are slow?"* - a summary grouped by `cs-uri-stem` with the average and maximum `time-taken`.
4. *"What does the application log say at 10:05?"* - the records around that time, and a search for `elapsed:` values
   of 1000 ms or more.
5. *"Anything in the System log?"* - the events of the open System tab around 10:05.
6. *"What did the machine do then?"* (Trial / Pro, with a Metrics View open) - CPU, memory and disk in the minutes around
   10:05, next to the first errors.
7. *"Keep the evidence - the log rotates in an hour."* - the assistant saves the error records with 20 records around
   each, plus the System events of the same minutes, as one redacted evidence package (with **Allow AI to save evidence
   and pin searches** on), and verifies it.
8. *"Watch for this."* - the assistant proposes an alert on the orders log - on its dated series, so it follows tomorrow's
   file too - and has TKTail check it. With **Allow AI to manage alerts** on, and after you say yes, it saves it;
   otherwise it gives you the definition to save yourself.
9. *"Is the alert running?"* - TKTail reports its state, the physical file it reads now, how far it has read and when it
   last evaluated new lines.

Every step's answer names its evidence; the evidence package keeps the records after the log is gone, and the alert's
incidents later keep the records around each match.

## Incidents and deployments

Each time an alert fires, TKTail keeps an **incident** - the record that matched, the records around it, Windows events
and counters of those minutes ([Incidents](https://tktail.dev/help/alerts-and-monitoring/#incidents)). An assistant reads them: *"What
happened in the last Payment errors incident?"*, *"List the new incidents since 14:30"* - **new** means not yet
acknowledged by you. It can link an evidence package to an incident. Acknowledging, pinning and deleting incidents are
yours, in the Incidents view - an assistant cannot change an incident.

**After a deployment**, ask about the time since it: *"List the incidents of every alert since 14:33, and compare them
with the hour before."*, *"Search the orders log since 14:33 for errors that did not occur before."* - the assistant
answers with incident lists and searches by time range. TKTail has no maintenance windows or named reference points
yet: alerts that fire during a planned restart are incidents like any other (you acknowledge them afterwards).

## Permissions

| Switch (Settings > AI Access (MCP)) | Default | What it allows |
|---|---|---|
| **Allow AI access (MCP)** | off | assistants may connect and read what is open in TKTail (the *Safe Workspace*) |
| **Investigation Roots** (Trial / Pro; **Tools > AI Investigation Roots...**) | none | below each folder you add and enable: listing, searching and opening log files - only you add folders |
| **Allow AI to save custom formats** | off | saving a format profile the assistant wrote |
| **Allow AI to save searches and Metric Sets** | off | saving, changing and deleting Saved Searches and your Metric Sets |
| **Allow AI to manage alerts** | off | creating, changing, enabling, disabling and deleting alerts |
| **Allow AI to save evidence and pin searches** | off | saving redacted evidence packages in the Evidence Store, within its limits, and pinning searches (deleting a package always needs you) |

How the assistant connects is separate: over stdio it is a program on your computer (every edition); over HTTP
(Trial / Pro) it needs the bearer token TKTail shows you. The license decides which features exist (Metrics, HTTP,
Investigation Roots); the switches decide what an assistant may do with them. Details and every refusal:
[Agent permissions](https://tktail.dev/help/ai-agents-permissions/).

```
  AI assistant
      |  MCP (stdio on this PC, or HTTP with a token)
      v
  TKTail - Allow AI access, the license's features
      |-- what is open in TKTail (Safe Workspace)
      |-- folders you approved (Investigation Roots)
      |-- changes: only with their own switch (formats, searches + Metric Sets, alerts, evidence packages)
      v
  logs, event logs you opened, Metrics, alerts, incidents
```

## Search and summaries

An assistant answers analytical questions without reading every record: a search can **summarize every match as it
finds it** - grouped by up to four keys (a field such as `c-ip`, or a value taken from the text), the top N groups, a
histogram per second, minute, hour or day, and the count, sum, minimum, maximum and average of a number. It can ask for
only **the count**, or result pages with **only the fields it needs**. The summary says whether it covers everything
(the search completed, nothing over a bound) - an assistant reports that with the numbers. How much less crosses to
the assistant, measured: [TKTail and scripting tools](https://tktail.dev/performance/competitive/).

## Rotated logs

Logs that start a new file every day - `info-2026-11-05.log`, `info-2026-11-06.log`, IIS `u_ex261106.log` - are one
*series* to TKTail. An assistant should search and watch the series, not one day's file: an alert made on today's file
follows tomorrow's, also after a restart and without a tab. Its incidents always name the physical file where the
match was, and the alert's status shows which file it reads now. Details: [Rotating dated log files](https://tktail.dev/help/rotating-dated-logs/).

## Preserving evidence

Under load a rotating log may keep only minutes of history. When an assistant finds what explains a problem, it can
**preserve** it at once - instead of copying a whole log with a shell command:

```
search  ->  aggregate / read  ->  pin the search (if the investigation goes on)  ->  save evidence
        ->  verify the package  ->  link it to the incident  ->  a shareable copy for the vendor
```

- **Save evidence** keeps the records the search found and the context asked for - by records (an error and its stack
  trace are one record) and / or by seconds - plus, if asked, other logs, event logs and Metric Sets of the same time
  window. TKTail goes straight to those records' place in the file: 57 errors with 20 records of context from a
  1 GB trace became a 142 KB package in 0.35 seconds, 47 MB (4.7 %) of the file read
  ([measured](https://tktail.dev/help/saving-evidence/#how-fast)).
- **Why through TKTail and not the shell**: an assistant with only a shell keeps evidence by copying whole logs -
  gigabytes, secrets included, with nothing saying where the copy came from. Through TKTail it gets bounded ranges, the
  source's identity and offsets, redaction, hashes and a record of who asked (you or an AI client, over which
  connection), when and why (the note) - and the package stays until you delete it.
- **Redacted before anything is written**: Authorization / Bearer headers, JWTs, passwords and connection-string
  passwords, API keys, private keys - and your own rules. Everything the assistant later reads from a package is the
  redacted package; there is no "unredacted" option for it.
- **Pinning** keeps a search across restarts and outside the assistant's limit of 5 searches - but only its
  references: the bytes are safe once they are in an evidence package. Pinning with *preserve* does both at once.
- **Verification** checks the package's hashes; a package stays valid after the original log is gone.
- **Deleting** a package: the assistant can only ask; you confirm or reject it in the Evidence Library.

Requests that work well:

| You ask | The assistant |
|---|---|
| *"Save these 57 results with 20 records of context."* | saves the search's results with 20 records before and after each |
| *"Include the IIS log and the Application event log for ±15 seconds."* | adds those sources for the same window |
| *"Create a redacted evidence package for the vendor escalation."* | saves it with a note; you make the shareable copy in TKTail |
| *"Pin this search and preserve its evidence."* | pins it and saves a package at once |
| *"List the saved evidence."* | lists the packages: when, what, how big, how many secrets were redacted |
| *"Verify the package's integrity."* | reads the package and reports VALID / MODIFIED / INCOMPLETE |
| *"Delete the duplicate package."* | asks you: the package is marked in the Evidence Library, and only you delete it |
| *"The vendor wants the whole trace file."* | saves the whole open file - redacted, compressed, paced - only when you really need it |

Everything about packages - the library, redaction rules, limits, sharing: [Saving evidence](https://tktail.dev/help/saving-evidence/).

## Alerts with an assistant

The recommended order: the assistant looks at the log and its format, writes the condition as a search and runs it on
the log, checks the proposed alert with TKTail (it tells what is invalid and whether it would be evaluated now), and
asks you before saving. After saving, it checks that the alert is alive (state, current file, last evaluation).
TKTail cannot yet replay an alert over past data to show how often it would have fired - run its condition as a
search over the period instead. [Alerts and monitoring](https://tktail.dev/help/alerts-and-monitoring/).

## Metrics and Windows events

With Trial / Pro, the assistant reads the Metrics TKTail collects - the Metric Sets, current values, samples over a
period, summaries - and relates them to log times ([Metrics](https://tktail.dev/help/metrics/)). It reads the Windows Event Log channels and
`.evtx` files you opened ([Windows Event Log](https://tktail.dev/help/windows-event-log/)); open System or Application yourself when the
investigation needs them.

## Evidence and which TKTail answered

Results carry the source, the line or event, the record's own time and a reference to open it again; incidents keep
the records around each match even after the file rotated. Every answer also names the TKTail that produced it - this
installation (`nodeId`) and this run (`instanceId`) - so an assistant does not mix up two computers or two runs.
[Which TKTail answered](https://tktail.dev/help/mcp/#which-tktail-answered).

## When TKTail is hidden, closed or restarted

- **Hidden in the notification area** (the **Hide to Notification Area** button in the title bar, or **Keep Running in the
  Notification Area** when exiting with enabled alerts asks): TKTail keeps running - alerts keep evaluating, an
  assistant keeps getting answers.
- **Closed**: alerts stop and assistants get no window to ask (TKTail is an application, not a Windows service).
- **Restarted**: alert definitions, their enabled state, incidents and their evidence, the workspace and the settings
  come back; enabled alerts start watching again at the end of each file (lines written while TKTail was closed are not
  evaluated); the assistant talks to a new run (a new `instanceId`) - earlier incidents keep the run that captured them.
  [What survives a restart?](https://tktail.dev/help/alerts-and-monitoring/#what-survives-a-restart)

## Assistants that work with TKTail

| Client | Tested | Connection | Notes |
|---|---|---|---|
| Claude Code | yes | stdio, HTTP | the client of TKTail's acceptance runs ([setup](https://tktail.dev/help/mcp/#connect-over-stdio)) |
| Other MCP clients (Claude Desktop, Visual Studio Code, ...) | not qualified | stdio, HTTP | a client of MCP 2025-03-26, 2025-06-18, 2025-11-25 or 2026-07-28 can connect - protocol-compatible, not tested by TKTail ([Connect any MCP client](https://tktail.dev/help/mcp-clients/)) |

## Questions

**Does an assistant get unrestricted file access?** No. It reads what is open in TKTail; with Trial / Pro also log
files below folders you approved. Nothing else.

**Can it see passwords?** It sees what your logs contain. Search results and records are sent as the log has them -
if a log writes tokens or passwords, an assistant you connect reads them there. Evidence packages are different:
secrets are replaced before a package is written, and an assistant only ever reads the redacted package. Close logs
with secrets, or do not allow AI access while they are open.

**Does my data leave the computer?** TKTail itself contacts nothing over the network. What it returns to an assistant
goes to that assistant - for most assistants, to its AI service. Allow access only while you want the assistant to see
what you are looking at.

**Can it restart a service or run PowerShell through TKTail?** No - TKTail has no such tool.

**Can it read the System event log?** When you opened System in TKTail, yes; it cannot open a channel itself.

**Can it change my alerts?** Only with **Allow AI to manage alerts** on, and it should ask you first. Alerts it saved
are marked as made by an AI client in Manage Alerts.

**Do alerts keep running when TKTail is in the tray?** Yes. When TKTail is closed, they stop.

**Can I see which source an answer came from?** Yes: every result names its file and line or its event, and opens in
TKTail.

**Which TKTail did it talk to?** Each answer names the installation and the run ([above](https://tktail.dev/help/ai-assistance/#evidence-and-which-tktail-answered)).

## More

[AI integration (MCP)](https://tktail.dev/help/mcp/) - connecting, HTTP, what is recorded · [Agent permissions](https://tktail.dev/help/ai-agents-permissions/) ·
[Agent quickstart](https://tktail.dev/help/ai-agents-quickstart/) - the loop an agent follows · [Investigation playbooks](https://tktail.dev/help/ai-agents-playbooks/)
· [MCP tool reference](https://tktail.dev/help/mcp-tools/) · the [AI Agent Harness](https://tktail.dev/help/ai-agents/#ai-agent-harness) of each release.

---

Source: https://tktail.dev/help/ai-production-incident/

# 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.

## 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)).

---

Source: https://tktail.dev/help/ai-developer-loop/

# Develop and debug with an AI coding agent

For developers who work with Claude Code or another AI coding agent: you changed code, built it and started the
application. Did it behave? This page shows how your coding agent uses TKTail to look at what the code actually did -
its logs, the Windows events and the machine's counters - and uses that to make the next change.

**TKTail is not the editor.** Your coding agent works with the source, the repository, the build and the tests.
TKTail is the runtime side: the application's logs and traces, the Windows Event Log, Metrics, alerts and saved
evidence - read through structured questions instead of whole files.

```
  edit the code (with the agent)
        |
  build, start, run the scenario or the tests
        |
  TKTail follows the logs, events and counters as they are written
        |
  the agent asks TKTail: errors? slow operations? what changed since the last run?
        |
  the next code change - and run again
```

## Set it up once

1. Open the application's log in TKTail (File > Open, or `tktail open <log>`). TKTail follows it while it grows - also a
   new file each day ([Rotating dated log files](https://tktail.dev/help/rotating-dated-logs/)).
2. Optional: open the **Application** event log, and a Metrics View of the machine (Trial / Pro).
3. **Settings > AI Access (MCP) > Allow AI access (MCP)**, then **Copy Client Configuration** - with Claude Code, save
   it as `.mcp.json` in your project folder (details: [AI integration (MCP)](https://tktail.dev/help/mcp/#connect-over-stdio)).
4. Ask your agent: *"Check the application after my last run."*

The agent now has TKTail beside its file and shell tools. It reads only what is open in TKTail (or below folders you
approved); it changes nothing in TKTail unless you allowed that kind of change.

## Case study: a slow endpoint

A synthetic example (the data is generated; names and numbers are invented).

**Run A.** You start build `1.4.0-dev.17` of an orders API and exercise it for five minutes. You ask the agent:
*"I just started dev.17 - check whether this run produced errors or obvious performance problems."*

Through TKTail the agent finds, without reading the log into the conversation:

| Question it asks TKTail | Answer |
|---|---|
| what happened at startup? | *Application started (build 1.4.0-dev.17)*; one warning: a missing setting `Cache:SlidingExpiration`, default used |
| errors since the start? | 3 × `System.InvalidOperationException: Sequence contains no elements` on `/api/customers` - with the record and its stack trace, not every copy |
| the slowest endpoints? (average and maximum of `elapsed:` per endpoint) | `/api/orders/search` 1,535 ms on average, up to 2,199 ms; every other endpoint under 0.2 s |
| which warnings, how often? | *query plan fallback: search without the index hint* - 517 times, once for every search request |

Its summary: *the search endpoint is slow and logs a query-plan fallback on every call - the index hint is missing; a
separate, older defect throws on /api/customers.* It changes the query and you build `1.4.0-dev.18`.

**Run B.** You start dev.18, run the same scenario and ask: *"I ran it again with the fix - did it help?"* The agent
compares the two runs by their start times in the same log: `/api/orders/search` now 119 ms on average instead of
1,535 ms, no fallback warnings, every other endpoint unchanged - and the `InvalidOperationException` is still there
(5 of 332 calls). It also says what the log cannot tell: whether the faster search returns the same results. It goes
on with the exception.

Both runs were done with Claude Code (2.1.302) against TKTail 1.2.0 on the generated data, each time as a new session:
16 and 14 TKTail calls; most answers a few KB, the largest 48 KB - 100 records with a summary the agent asked for; every
figure equal to the generator's ground truth.

The loop - change, run, ask, change - happens without you opening the log, Event Viewer or Task Manager, and without
the agent pasting thousands of lines into its context.

## Questions to ask your coding agent

- *"Check whether my latest run produced any new errors."*
- *"What are the slowest endpoints since the last application start?"*
- *"Show the exceptions that appeared after 14:20 - grouped, one example each."*
- *"Which operation is generating the most warnings?"*
- *"Check startup - any warnings or errors before the first request?"*
- *"Compare application errors with Windows events around the crash."* (with the Application log open)
- *"Did memory use increase during this test?"* (Trial / Pro, with a Metrics View open while the test ran)
- *"Summarize everything with correlation ID 7f3c."*
- *"Save the records around this failure as evidence."*

## Structured logs answer better

When your log has fields - a timestamp, a level, an endpoint, an elapsed time, an account, a correlation ID - TKTail
reads them: from a built-in format (IIS, JSON lines, CSV, ...), from a format you or the agent defined ([Your own log
formats](https://tktail.dev/help/custom-formats/)), or as a value taken from the text (`elapsed: 1534ms`). Then the agent asks for *"the top
10 endpoints by average elapsed time"* or *"errors grouped by account"* and gets the summary, not the records.

## One time window, several sources

A warning in the application log at 12:02:17, a CPU spike in Metrics, an entry in the Application event log and an IIS
502 at the same second: TKTail puts them on one time scale, so the agent can tell a defect in the code from a problem
in the environment.

## When a test fails

When an integration or end-to-end test fails, tell the agent when it ran: *"The checkout test failed at 10:41 - what did
the service log then?"* It reads the records of that time window and the events around them and summarizes the
likely cause. TKTail does not run your tests; it reads what they left in the logs.

## Keep the evidence

A trace that rotates every few minutes, a failure you want to show a colleague, the exact runtime proof of a
regression: *"Save the records around this failure as evidence, 20 records each side."* The package is redacted
(tokens and passwords removed), verifiable, and stays after the log is gone - attach its shareable copy to the bug
report ([Saving evidence](https://tktail.dev/help/saving-evidence/)). Saving needs **Allow AI to save evidence and pin searches**.

## Light enough for the machine you debug on

TKTail reads files in bounded blocks, keeps memory bounded by its caches rather than by the size of the log, and does
its searching on background workers - it is meant to run beside the application it observes
([Huge files and network shares](https://tktail.dev/help/large-and-network-files/)).

## Which coding agents

| Agent | Status |
|---|---|
| Claude Code | **tested** - TKTail's acceptance runs use it ([setup](https://tktail.dev/help/mcp/#connect-over-stdio)) |
| Codex and other MCP clients | protocol-compatible (MCP over stdio or HTTP), **not tested by TKTail** ([Connect any MCP client](https://tktail.dev/help/mcp-clients/)) |

---

Source: https://tktail.dev/help/mcp/

# AI integration (MCP)

An AI assistant that supports the **Model Context Protocol** (MCP) - for example Claude Code - can
investigate with TKTail: which logs, event logs and Metrics Views are open, the record you are
looking at (already parsed into fields, with its time and its whole multi-line text), the records
just before and after it, the records near a time, every record of a request - found with
TKTail's own search, across your open logs and event logs - sequences such as "a request received,
then within 10 seconds an error for the same request ID", your alerts and the evidence their
incidents kept, and what CPU, memory and disk did around a time (Trial / Pro: the Metrics TKTail
collects for you). The assistant asks TKTail for evidence instead of you copying log text into a
chat, and it never reads the files itself.

| | Free | Trial / Pro |
|---|---|---|
| Connect over **stdio** (the assistant starts `TKTail.exe mcp --stdio`) | yes | yes |
| Connect over **HTTP** (the assistant connects to the running TKTail - also from another computer) | - | yes |
| What is open in TKTail (the *Safe Workspace*) | yes | yes |
| Folders you approve (*Extended Investigation*) | - | yes |
| Metrics (Windows performance counters) | - | yes |

AI access is **off until you allow it**, and an assistant **changes nothing** unless you also allow that
kind of change: saving format profiles, saving searches and Metric Sets, managing alerts - each its own
permission ([What AI clients may change](https://tktail.dev/help/mcp/#what-ai-clients-may-change)).

## What the assistant can and cannot see

| Can ask for | Cannot |
|---|---|
| TKTail's version, license edition and what it can do now | open, read or list files, folders or disks - or any file you have not opened in TKTail |
| the sources open in the main window: file paths, formats, encodings, sizes, the time range of the records read so far; event log channels or `.evtx` files; Metrics Views and their counters | search a folder, or a path it names (only what is open in TKTail, and folders you approved) |
| the current record of the view in front: its lines, time, fields, Summary and text (16 KB by default, at most 64 KB); the selected event; the selected metric series and its latest value | run commands, a terminal, programs or scripts; change settings, Investigation Roots or files; close or start anything |
| one record (a whole multi-line entry) by line, position or a reference TKTail gave it; up to 50 records before and after a record, an event or a time | cancel or close your searches (only its own) |
| searches of the open sources - text, regular expression, field conditions (`requestId = ABC123`), time ranges, a number taken from the text (`elapsed: 1985.000ms` at least 1000) - and their results, page by page, only the fields it needs or just the count; a summary of what a search found - the top 10 client IPs, requests per minute, the average elapsed time - computed by TKTail; sequences of evidence in time windows, correlated by a key; your Saved Searches (to list and run) | see a linked window's current record (only the main window answers) |
| the list of TKTail windows (main and linked) with the sources each shows | start collecting performance counters, or read counters TKTail does not collect |
| *(Trial / Pro)* the Metric Sets, the metrics TKTail collects or still keeps, their current values, samples over a period (at most 24 hours, every gap said) and summaries | use a metric in a search or a sequence (a later version) |
| the formats TKTail knows, raw sample records of an open log, how TKTail chose a log's format, and a check and preview of a format profile it proposes - with TKTail's own parser | change a built-in format, a `.tktail` file or another log's format |
| your alerts, their incidents and the evidence each incident kept; a check of an alert it proposes | delete, acknowledge or export incidents |
| **with your permission**: save a format profile; save, change or delete Saved Searches and your Metric Sets; create, change, enable, disable or delete alerts | anything else - there is no permission for settings, files or programs |

**Whatever TKTail returns, the assistant may send to its AI service** (for most assistants, a cloud
model). Logs can contain names, addresses, tokens or customer data: allow access only while you
want the assistant to see what you are looking at, and close tabs it should not list.

## Extended Investigation: folders you approve

Sometimes the evidence is in a log you have not opened yet. With a Trial or Pro license, **Tools > AI
Investigation Roots...** lists the folders an assistant may investigate beyond your open tabs:

- **Add...** chooses a folder; its check box enables or disables it; **Label...** names it
  (*Production*); **Remove** takes the approval away (the folder itself is untouched); **Open Folder**
  shows it in Windows Explorer.
- Below an enabled folder the assistant can list log files (names, sizes, the format TKTail would use -
  at most 1,000 at a time), search them with TKTail's search, and open one as a tab to read its records.
  It cannot read anything outside those folders: another folder, a path with `..`, a link (junction or
  symbolic link) that leads elsewhere, or a folder you disabled is refused.
- Only you add folders - the assistant can list them, never add one. Each change is written to
  **Output > Application**. A file the assistant opened appears as a tab, like your own.

Free uses the Safe Workspace only: open the files in TKTail and the assistant investigates them.

## What an assistant can do with it

- *"Explain the error I am on, and what happened just before."* - the current record (the whole
  stack trace, also when you clicked one of its lines), then the records before and after it.
- *"Find every record of this request."* - a search of all open sources for the request ID (a
  field condition where the format has the field, the text otherwise), Event Log events included;
  then the records around any of the results.
- *"Which 10 client IPs caused the most 500 errors, and how many requests per minute were there?"* - a
  search for the errors, then TKTail summarizes what it found: the top 10 keys with their counts, a
  histogram per minute, the average and maximum of a number such as `time-taken` - without sending
  every record to the assistant. The answer says when it covers less than everything (more results
  than TKTail keeps, a log that changed since the search) and points to the first record of each group.
- *"Which requests took 1000 ms or longer?"* - a search with a number condition: the number after
  `elapsed: ` (or any value a pattern captures) compared as a number - `1985.000` counts, `1,5` or
  `12ms` never.
- *"What was logged around 14:02?"* - the record nearest that time, as **Edit > Go To Time** finds
  it. If TKTail has not read the file's times yet, the assistant can ask it to (as **View > Read
  the File's Times**).
- *"Did a request in payments.log fail downstream within 10 seconds, and did Windows log a warning
  after it?"* - a sequence search: each match is one request with its steps in order, their times
  and the request ID that ties them.
- *"Why is this log shown as plain text? Write a format for it."* - the assistant reads a sample of
  the log's records, writes a profile, and has TKTail validate it and preview it on the log's own
  records until every record parses; then gives it to you, or - if you allowed it - saves it.
- *"Watch this log for payment errors."* - with your permissions: a profile, a Saved Search and an
  alert ([Set up monitoring with an assistant](https://tktail.dev/help/mcp/#set-up-monitoring-with-an-assistant)).
- *"What happened in the last Payment errors incident?"* - the trigger record, the records before and
  after it, the events and the metric samples the alert kept, each with its state.
- *"What did CPU, memory and disk do in the minute around this error?"* - with a Metrics View open
  (for example **Host Basics**): minimum, average and maximum around the error's time, the peak, and
  whether samples were missing. A reading TKTail could not take is reported as missing - never as zero.

The assistant's searches appear in **Search Results**, marked **AI** (`#19  AI · requestId = ABC123
...`) and in Jobs - you see what was searched for you. TKTail keeps the assistant's five most recent
searches; it never closes or cancels yours for it. When a search could not look at everything (a
regular expression too complex for some lines, more results than TKTail keeps, a cancelled search) the
assistant is told that evidence may be missing.

## Turn it on

**Settings > AI Access (MCP)** has everything in one place - what is allowed now, what your license includes,
the permissions, your Investigation Roots, and what to give your AI client:

1. **Allow AI access (MCP)** on that page, or **Tools > Allow AI Access (MCP)** (a check mark shows it is on).
   Only the main window answers AI clients. TKTail remembers the choice.
2. Connect your assistant - over **stdio** (every edition) or **HTTP** (Trial / Pro), below.
3. Optional: the permissions under **What AI clients may change** ([below](https://tktail.dev/help/mcp/#what-ai-clients-may-change)).

The tools, their arguments and bounds: [MCP tool reference](https://tktail.dev/help/mcp-tools/). Connecting another client, a script or
an agent framework: [Connect any MCP client](https://tktail.dev/help/mcp-clients/). How an agent investigates, what it may do, and the
documentation each release publishes for agents: [AI agents](https://tktail.dev/help/ai-agents/).

### Connect over stdio

The assistant starts `TKTail.exe mcp --stdio` itself when it needs it, on the same computer; you do not run
it. **Copy Command** copies the command with the full path, **Copy Client Configuration** a ready
`mcpServers` entry. Nothing listens on the network.

**Claude Code** (tested with Claude Code 2.1.177). Save this as a JSON file with the full path of
your `TKTail.exe` (backslashes doubled):

```json
{
  "mcpServers": {
    "tktail": {
      "type": "stdio",
      "command": "C:\\<TKTail folder>\\TKTail.exe",
      "args": ["mcp", "--stdio"]
    }
  }
}
```

Start Claude Code with it: `claude --mcp-config <file>`. The same content works as `.mcp.json` in a project
folder. Then ask, for example: *"What am I looking at in TKTail? Explain the error in the current record."*

**Other MCP clients** start a local server from a command and its arguments: `TKTail.exe` (the full path) with
`mcp` and `--stdio`. Clients that read an `mcpServers` JSON entry (for example Claude Desktop's configuration
file) take the entry **Copy Client Configuration** gives. The server uses the license TKTail would use (beside
`TKTail.exe`, then the data folder); another license file: `"args": ["mcp", "--stdio", "--license-file",
"C:\\<folder>\\TKTail.license"]`.

### Connect over HTTP

*Trial, Pro and Developer licenses.* The running TKTail accepts assistants that connect to it - an assistant
that does not start programs, one in another tool, or one on another computer (TKTail runs on the server you
are diagnosing; the assistant on your desk).

1. Settings > AI Access: **Accept AI clients over HTTP**, then **Apply**. The status line says what really
   runs: *Listening on this computer only (127.0.0.1 and ::1), port 47711. Every request needs the token.*

2. **Copy HTTP Client Configuration** and put it into your client's configuration:

   ```json
   {
     "mcpServers": {
       "tktail": {
         "type": "http",
         "url": "http://127.0.0.1:47711/mcp",
         "headers": {
           "Authorization": "Bearer tkt_..."
         }
       }
     }
   }
   ```

   Claude Code: save it as a file and start `claude --mcp-config <file>`. Other clients take the **Address**
   and an `Authorization: Bearer <token>` header.
3. Ask as usual. The assistant gets exactly what it would over stdio - the same tools, the same permissions.

**The token.** Every HTTP request needs it - also on this computer. TKTail makes it the first time HTTP is used
and keeps it encrypted for your Windows user in the data folder (`mcp-http.token`). It is a password: whoever has
it can use what your permissions allow. Settings never shows it - **Copy Token** puts it on the clipboard (the
status line shows only `tkt_ab…yz`). Keep configuration files that hold it in your own profile, not in a shared
folder or a source repository. **Regenerate Token...** makes a new one: every client with the old token is refused
from its next request; give your clients the new configuration.

**Another computer.** **Listen on: Every network interface** (TKTail asks you to confirm) makes TKTail listen on
all network interfaces at the **Port** (47711; another one in Settings if it is taken). The connection is **plain
HTTP - not encrypted**: use it only on a trusted network, through a VPN, or through a tunnel (for example an SSH
port forward to the loopback address - then keep *This computer only*). Windows Firewall may ask whether to allow
TKTail. The **Address** then names this computer (`http://<computer>:47711/mcp`).

**Turn HTTP off** with the same check box: TKTail stops listening at once and connected clients are disconnected.
Only the main window listens; a linked window never does.

## What AI clients may change

Each kind of change is its own permission under **Settings > AI Access > What AI clients may change** -
independent of each other, and only together with AI access. All are off by default except evidence packages:
keeping the proof before a log rotates should not wait for a settings change.

| Permission | The assistant may | Never |
|---|---|---|
| Allow AI to save custom formats | save a format profile it wrote and checked with TKTail (and use it for an open log until you close it) | change a built-in format or a `.tktail` file |
| Allow AI to save searches and Metric Sets | create, change and delete Saved Searches and your Metric Sets | change a built-in Metric Set |
| Allow AI to manage alerts | create, change, enable, disable and delete alerts | delete, acknowledge or export incidents |
| Allow AI to save evidence and pin searches (off) | save redacted evidence packages in the Evidence Store, within its limits, and pin searches ([Saving evidence](https://tktail.dev/help/saving-evidence/)) | delete a package (it can only ask - you decide), read secrets the redaction removed, write a package anywhere but the Evidence Store or a folder below an Investigation Root you approved |

- **Your changes are never overwritten.** A change names the version the assistant read; if you edited the
  alert, search or set since, TKTail refuses it and the assistant reads it again.
- **Only what it may read.** A saved search or an alert may name the sources open in TKTail, event log channels,
  performance counters (alerts), and files or folders below an Investigation Root you approved - nothing else.
  The evidence an alert keeps follows the same rule.
- **Roots you take back.** An alert an assistant made that reads below an Investigation Root is disabled when
  you remove or disable that root: TKTail says so in Problems, the status bar and Output > Alerts. Edit it in
  **Tools > Manage Alerts** to keep it - it is then your own alert.
- **You see every change.** It is in Manage Alerts, Saved Searches and the Metric Sets at once, in the status
  bar and in Output (*An AI client created the alert "Payment errors" (#3, version 1).*).
- Turn a permission off the same way; the assistant's next change is refused.

Without a permission, the assistant can still propose: it checks an alert or a profile with TKTail and gives it
to you to create in Manage Alerts or import in the Custom Format Studio.

## Which TKTail answered

Every answer says where it comes from - also an error, and also a copy of an answer pasted somewhere else - so an
assistant working with several TKTails (or with notes from yesterday) never mixes up whose evidence it is:

- **Node ID** - this TKTail's data folder on this computer: a random ID TKTail makes once. It stays the same when
  TKTail restarts; another data folder, a portable copy or another computer has its own. It is never derived from
  your hardware. **Settings > AI Access** shows it; **Copy Node ID** copies it.
- **Instance** - this run of TKTail (a new one each time TKTail starts) and its window (*Window 1*, *Window 2*).
- **Display name** (optional) - your name for this TKTail, for example *Order Server*: **Settings > AI Access >
  Display name**. It is a label - two TKTails may have the same one.
- **Only if you choose** - the computer name, your Windows user name and its domain: each stays off until you tick
  it under **How AI clients see this TKTail**, and applies to the next answer.

The main window answers for every TKTail window; the list of windows names each window's own instance. An incident
says which TKTail run captured it - after a restart, that is not the run answering now; an incident recorded by an
earlier TKTail version says its origin is not known.

## Set up monitoring with an assistant

On a computer with nothing configured yet - a semicolon-separated export TKTail opens as **CSV (semicolon)**,
the time in the third column - an assistant can set up the whole chain. With AI access and the three permissions
allowed, ask: *"Make a format for the export I have open - the time is in column 3, the level in column 5 - then
watch it for ERROR records and alert me with the records around each one."*

1. **A profile from the log.** The assistant asks TKTail for a draft fitted to the open log (its delimiter,
   quote and header and one field per column - the Studio's **Create Format for This Log**), gives column 3 the
   timestamp role, the level column the severity role, the message its role; checks it with TKTail's
   validator and previews it on the log's records; then saves it and uses it for the log. The profile is in the
   Custom Format Studio; to use it every time the file is opened, the profile can name the file
   ([recipe](https://tktail.dev/help/custom-formats/#recipe-a-profile-over-a-detected-csv)).
2. **A Saved Search** - `severity_level = ERROR` over that log - in **Saved Searches** like your own.
3. **An alert** with the same condition, a severity, a notification and the evidence to keep (the 5 records
   before and after) - checked first, then saved; Manage Alerts shows it, marked as made by an AI client.
4. When an ERROR record arrives, the alert fires and the incident keeps its evidence; the assistant can read it.

All of it is your configuration from then on: after a restart the profile, the Saved Search, the alert and its
incidents are there as if you had made them.

### Alerts on logs that rotate by date

An assistant names a log by its sourceId. When TKTail follows that log as a dated series (`info-2026-11-05.log`,
then `info-2026-11-06.log` - [Rotating dated log files](https://tktail.dev/help/rotating-dated-logs/)), the alert it saves follows the
series: TKTail fills the pattern in (`"series": "info-{YYYY-MM-DD}.log"`), and the alert watches the newest file -
also with no tab open, and after a restart. For a series TKTail does not detect by itself the assistant gives the
pattern (`u_ex{YYMMDD}.log`, `app.{YYYYMMDD}.{N}.log`); `"series": ""` keeps exactly one file.

To prove an alert is alive, `tktail_get_alert` answers with its **runtime**: *watching* (or *waitingForFile* and
why), the file it reads now and its identity, how far it has read, when it last evaluated new lines, the series'
state and how many times it moved on, the last incident. The tool schemas list every value TKTail accepts, with
complete examples that are tested against TKTail itself.

## What a question looks like

You open `payments.log` and click line 4 - inside a stack trace. The assistant calls
`tktail_get_current_context` and receives (shortened):

```json
{
  "contextKind": "file",
  "sourceName": "payments.log",
  "formatId": "builtin:applog",
  "position": { "byteOffset": 185, "line": 4, "column": 1 },
  "record": {
    "firstLine": 2, "lineCount": 4, "caretLineInRecord": 3, "state": "complete",
    "time": { "kind": "local", "value": "2026-10-08T10:00:01.250" },
    "summary": { "title": "ERROR · Payment", "status": "ERROR" },
    "fields": [ { "name": "level", "value": "ERROR", "role": "severity" },
                { "name": "exception", "value": "System.InvalidOperationException", "role": "exception" } ],
    "text": "2026-10-08 10:00:01.250 ERROR [Payment] Payment failed for order 42\nSystem.InvalidOperationException: card declined\n   at Payments.Gateway.Charge(Order o)\n   at Payments.Service.Run()",
    "textTruncated": false
  }
}
```

The record is the whole entry (lines 2-5), not just the clicked line, and its time is the
record's own timestamp - local time, because the log names no time zone.

## Turn it off

**Tools > Allow AI Access (MCP)** again (or the check box in Settings). From then on every tool answers that
access is off (and how to allow it) - also for an assistant connected at that moment: its next question is
refused. Turning off **Accept AI clients over HTTP** also closes HTTP connections. Removing an Investigation Root
works the same way: the assistant's next question about that folder is refused. Removing the entry from your AI
client's configuration stops it from connecting at all.

## How TKTail keeps it safe

- **Your consent**: nothing is answered until you allow AI access; every kind of change and every Investigation
  Root is a separate permission you give.
- **Only what you opened** (the Safe Workspace), plus folders you approved (Extended Investigation): never a
  path the assistant invents, never `..` or a link out of an approved folder - also not through a saved search
  or an alert.
- **No system access**: no commands, programs, terminal, services, registry or settings; no file written except
  through TKTail's own stores (profiles, Saved Searches, Metric Sets, alerts) when you allowed it.
- **Bounded**: every answer has limits (text per record, records per call, results per page - listed in the
  [tool reference](https://tktail.dev/help/mcp-tools/)); long results come page by page; what was cut is marked.
- **One owner**: the main window answers; a linked window never does.
- **Your names stay yours**: answers name this TKTail by random IDs; the computer name and your Windows account are
  sent only if you tick them in Settings, and never written to TKTail's log.
- **HTTP**: off by default, Trial / Pro only, a token on every request, this computer only unless you choose
  the network; requests from web pages are refused.
- **Recorded**: every answer is listed in Output > Application (which tool, how it ended - never the content).

## What TKTail records

**Output > Application** (and the TKTail log file) gets one line per answer - which tool, how it
ended, how many bytes and how long it took, for example
`AI client (MCP): tktail_get_current_context - answered (1815 bytes, 0.2 ms)` - never what was
sent. Over HTTP also when TKTail starts or stops listening (*MCP over HTTP listening on
http://127.0.0.1:47711/mcp (this computer only)*) and every refused request with its address and reason
(*AI client over HTTP (127.0.0.1): request - HTTP 401 unauthorized*) - never the token. The stdio server writes
a few diagnostic lines to its error output, which AI clients keep in their own logs (Claude Code lists them
as "Server stderr").

## Troubleshooting

| The assistant (or its client) says | What to do |
|---|---|
| No TKTail window is running | Start TKTail and open the logs; the server then answers from that window. Without a window it can only say so (it never starts TKTail). |
| AI access to the TKTail window is off | Tools > Allow AI Access (MCP) in the main window. |
| The TKTail window did not answer in time | TKTail was busy for more than 10 seconds (for example a modal operation); ask again. |
| Two searches are running in TKTail | TKTail runs two searches at a time; the assistant waits instead of stopping yours - ask again when one has finished. |
| The reference was made before the file changed | The log was rotated, truncated or replaced since the assistant got that record. Ask it to search again or to use the current record. |
| TKTail has not read this file's record times yet | Let the assistant ask TKTail to read them, or use **View > Read the File's Times** yourself. |
| Folders are outside the Safe Workspace | Open the files in TKTail first, or approve the folder as an Investigation Root (Trial / Pro). |
| Saving format profiles / searches / managing alerts is off for AI clients | Allow that kind of change in Settings > AI Access, or create it yourself from what the assistant proposes. |
| The alert / Saved Search / profile changed since it was read (conflict) | You (or another client) edited it. The assistant reads it again - your changes are never overwritten. |
| An alert made by an AI client was disabled | One of the Investigation Roots it reads was removed or disabled. Approve the root again, or edit the alert in Manage Alerts to keep it as yours. |
| Extended Investigation / Metrics / HTTP is included with Trial and Pro licenses | Use stdio and what is open in TKTail, or a Trial / Pro license. |
| The path is outside the Investigation Roots | The file or folder is not below a folder you approved (or that folder is disabled). |
| TKTail does not collect or keep this metric | Open the Metric Set or a Metrics View in TKTail (**View > Metrics...**); the assistant never starts collection itself. |
| A TKTail window runs, but it is an older version | Use the same TKTail version for the window and the MCP server. |
| contextKind `none` | Nothing is focused, or the view in front has no current record. Click into a log, an event or a series. |
| HTTP: connection refused | Accept AI clients over HTTP is off, not applied, or TKTail is not running; the AI Access page shows the state. A client on another computer needs *Every network interface* (and the firewall to allow TKTail). |
| HTTP 401 / unauthorized | The token is missing or old (it was regenerated). Copy HTTP Client Configuration again. |
| Settings: Not listening: port 47711 is already in use | Another program uses the port: choose another **Port** and Apply, and update the client's address. |
| HTTP 403 | The client sent a host name or a web page origin TKTail does not accept: use the **Address** Settings shows (`127.0.0.1` on this computer). |
| HTTP answers take tens of milliseconds (at times seconds) on this computer only | Security software that inspects HTTP - also on this computer's own addresses - holds requests before TKTail gets them (measured: about 12 ms each). TKTail waits long enough for a request; answers are not lost. |
| HTTP 404 with a session | TKTail restarted, the token was regenerated or the session was idle 30 minutes: the client starts a new session (most do by reconnecting). |

TKTail talks to the TKTail running for your Windows user - one per user, as for opening files from
Explorer. The protocol details, limits and errors are in the developer reference
(docs/MCP.md).

---

Source: https://tktail.dev/help/ai-agents/

# AI agents

TKTail gives an AI agent evidence from your logs instead of log text pasted into a chat: the agent asks TKTail over the
Model Context Protocol (MCP) and TKTail answers with parsed records, search results, alerts, incidents and metrics -
only from what you opened or approved, and only after you allowed AI access. This section is for the people who connect
an agent and for the agent itself.

| Page | What it is for |
|---|---|
| [AI integration (MCP)](https://tktail.dev/help/mcp/) | turning AI access on, connecting Claude Code or another client, what an assistant can and cannot see |
| [Connect any MCP client](https://tktail.dev/help/mcp-clients/) | the connection contract: stdio and HTTP, protocol revisions, shapes, paging |
| [Agent quickstart](https://tktail.dev/help/ai-agents-quickstart/) | the investigation loop: Discover, Inspect, Narrow, Correlate, Report |
| [Agent permissions](https://tktail.dev/help/ai-agents-permissions/) | what decides what an agent may read and change, and what each refusal means |
| [Investigation playbooks](https://tktail.dev/help/ai-agents-playbooks/) | a request, an alert, an unknown format, performance - with example prompts and calls |
| [MCP tool reference](https://tktail.dev/help/mcp-tools/) | every tool, its arguments and bounds |

## Where an agent learns TKTail

The authority is always the TKTail you run: an MCP client gets every tool with its description and input schema from
the server itself (`tools/list`) and the server's `instructions` from `initialize`. For agents that read documentation
before they connect, the website publishes the same facts in machine-readable form:

| File | Address | What it holds |
|---|---|---|
| `llms.txt` | <https://tktail.dev/llms.txt> | the index for AI assistants: the current version, these pages, the references |
| `llms-full.txt` | <https://tktail.dev/llms-full.txt> | this section and the product Help as one text file, with its version |
| AI manifest | <https://tktail.dev/ai/manifest.json> | the current version, the AI Agent Harness of each release (address, size, SHA-256), the references |
| MCP tool reference | <https://tktail.dev/ai/mcp-tools.json> | every tool as the release serves it - schema, annotations - with the capability, permission and window it needs |

The tool reference is generated from the tools TKTail.exe serves; a build whose tools differ from it fails its tests.

## AI Agent Harness

### What it is

The **AI Agent Harness** is a small ZIP published with each TKTail release (`TKTail-<version>-ai-harness.zip`): the
agent documentation of exactly that release in one place - the pages of this section, `llms.txt`, `llms-full.txt`, the
MCP tool reference, the format schema, example calls and generic client configurations. It is a **documentation /
configuration package only**: no program, no script, no binary, nothing to install or run.

### Who needs it

Nobody needs it to use TKTail or to connect an assistant - `TKTail.exe mcp --stdio` and Settings > AI Access (MCP) are
all a client needs ([Turn it on](https://tktail.dev/help/mcp/#turn-it-on)). It helps when the documentation must travel with the agent:

- an agent framework or a team that gives its agents a fixed knowledge pack instead of web pages;
- a server without internet access, where TKTail runs and the agent is set up offline;
- investigations you want to repeat: the harness describes the tools of one exact TKTail build, not the newest website.

### What it contains

| Path | Contents |
|---|---|
| `README.md` | what the package is, how to verify it, what it does not do |
| `manifest.json` | the harness and the TKTail it belongs to: version, `TKTail.exe` SHA-256, source commit, MCP registry digest, generated time, every file with its size and SHA-256 |
| `SHA256SUMS.txt` | the SHA-256 of every other file |
| `llms.txt`, `llms-full.txt` | the index and the full text, as the website published them for this release |
| `mcp-tools.json` | the MCP tool reference of this release (the same as `/ai/mcp-tools.json` was for it) |
| `agent-guide/` | the pages of this section as Markdown |
| `schemas/` | the JSON Schema of a format profile |
| `examples/` | the example tool calls of the [playbooks](https://tktail.dev/help/ai-agents-playbooks/), one JSON file each |
| `client-config-examples/` | generic MCP client configurations for stdio and HTTP, with placeholders |

No personal data, credentials, tokens, license codes, local paths, tests or build files are in it.

### Version compatibility

**Use the AI Agent Harness that matches the installed TKTail version.** Each release has its own harness, and a
release's harness never changes: a correction is published as a new revision beside it, never over it. Previous
releases keep theirs - the [Download page](https://tktail.dev/download/) lists them with each release. A newer harness
can describe tools, arguments or rules your TKTail does not have; an older one misses what yours added.

Which TKTail you have: **Help > About TKTail**, `tktail version`, or `tktail_status` (its `version`). The harness's
`manifest.json` names its TKTail version and the SHA-256 of its `TKTail.exe` - the same as `Get-FileHash TKTail.exe`
when it is the release's exe.

### Verification

1. Compare the ZIP's SHA-256 (`Get-FileHash TKTail-<version>-ai-harness.zip`) with the Download page, the release's
   `SHA256SUMS.txt` or `/ai/manifest.json` - three places, one value.
2. Inside, `SHA256SUMS.txt` lists every file; `manifest.json` lists the same files and the TKTail they belong to.
3. `manifest.json` `product.exeSha256` is the SHA-256 of that release's `TKTail.exe`.

### Permissions

Downloading the AI Agent Harness does not grant an AI assistant access to files, logs, or the operating system. What an
assistant can reach is decided by TKTail, never by documentation: a running TKTail, your **Allow AI access (MCP)**, the
MCP configuration of your client, the transport (stdio, or HTTP with its token), the Investigation Roots you approved,
the permissions for changes, and the capabilities of your edition - [Agent permissions](https://tktail.dev/help/ai-agents-permissions/).

### MCP setup

`client-config-examples/` holds generic configurations - a command and its arguments for stdio, an address and a bearer
token header for HTTP - with placeholders for the path and the token. Your client's own syntax is in its documentation;
TKTail's ready entry is **Settings > AI Access (MCP) > Copy Client Configuration** ([Connect over
stdio](https://tktail.dev/help/mcp/#connect-over-stdio), [Connect over HTTP](https://tktail.dev/help/mcp/#connect-over-http)). A token is never in the harness:
**Copy Token** gives yours.

### Safe vs Extended access

- **Safe Workspace** (every edition): the sources open in the TKTail window - logs, event logs, Metrics Views - and
  nothing else. Open a file in TKTail and the agent can investigate it.
- **Extended Investigation** (Trial and Pro): folders you approve as Investigation Roots (**Tools > AI Investigation
  Roots...**); below them an agent can list log files, search them and open one as a tab. Only you add a root
  ([Extended Investigation](https://tktail.dev/help/mcp/#extended-investigation-folders-you-approve)).

### Investigation workflows

The [Agent quickstart](https://tktail.dev/help/ai-agents-quickstart/) is the loop every investigation follows; the [playbooks](https://tktail.dev/help/ai-agents-playbooks/)
apply it to a request, an alert, an unknown format and a performance question.

### This release's harness

TKTail 1.2.0: [TKTail-1.2.0-ai-harness.zip](https://tktail.dev/releases/1.2.0/TKTail-1.2.0-ai-harness.zip) - for TKTail 1.2.0 exactly (its
50 MCP tools). The file's size and SHA-256 are on the [Download page](https://tktail.dev/download/#ai-integration-kit),
in the release's [SHA256SUMS.txt](https://tktail.dev/releases/1.2.0/SHA256SUMS.txt) and in the [AI manifest](https://tktail.dev/ai/manifest.json);
the harness of an earlier release is listed with that release on the Download page.

---

Source: https://tktail.dev/help/mcp-clients/

# Connect any MCP client

This page is for people who connect TKTail to an AI client, an agent framework or their own script - and for the
model on the other side. It lists what a client needs to know; [AI integration](https://tktail.dev/help/mcp/) is the user's view, the
[MCP tool reference](https://tktail.dev/help/mcp-tools/) the exact tools, and the developer reference (docs/MCP.md) every
detail.

## Connection

| | stdio | Streamable HTTP |
|---|---|---|
| Who starts what | the client starts `TKTail.exe mcp --stdio` | the client connects to the running TKTail |
| Edition | every edition | Trial, Pro, Developer |
| Turned on by | the user: Allow AI access | the user: Allow AI access + Accept AI clients over HTTP |
| Address | standard input / output, one JSON-RPC message per line | `POST http://127.0.0.1:47711/mcp` (port and network bind are the user's settings) |
| Authentication | your Windows user (the per-user pipe) | `Authorization: Bearer <token>` on every request - also on this computer |
| Configuration | Settings > AI Access > Copy Client Configuration | Settings > AI Access > Copy HTTP Client Configuration |

**Protocol revisions**: `2026-07-28` (stateless: `_meta` `io.modelcontextprotocol/protocolVersion` and
`io.modelcontextprotocol/clientCapabilities` on every request) and `2025-11-25`, `2025-06-18`, `2025-03-26`,
`2024-11-05` (an `initialize` handshake). Capabilities: `tools` only - no resources, prompts or sampling.

**HTTP specifics**:

- `Content-Type: application/json`; `Accept` must include `application/json` (`application/json,
  text/event-stream` is fine). Replies are single JSON objects - TKTail opens no event stream (`GET` is 405).
- One message per POST; notifications are answered with 202, batches are refused.
- Handshake revisions: `initialize` returns `Mcp-Session-Id`; send it with every later request and `DELETE /mcp`
  with it to end the session. 404 means the session is gone (TKTail restarted, the token was regenerated, or 30
  idle minutes) - initialize again.
- `2026-07-28`: send `MCP-Protocol-Version`, `Mcp-Method` and, for `tools/call`, `Mcp-Name` - they must equal the
  body (400 otherwise).
- 401: the token is missing or replaced; 403: a `Host` other than a loopback name (when TKTail listens on this
  computer only) or a browser `Origin`; 503: more than 8 connections at once.

## First calls and refusals

Start with `tktail_status`, `tktail_list_sources` and `tktail_get_current_context` - the [Agent
quickstart](https://tktail.dev/help/ai-agents-quickstart/) is the whole loop, with complete calls. Source ids (`src-...`) and evidence
references are valid while that TKTail runs: list again after a restart; pass references back unchanged.

Every refusal is a tool result with `isError: true` and `structuredContent.error {category, message}` - the message
says what the user can do; tell the user instead of retrying. What decides access and what each category means:
[Agent permissions](https://tktail.dev/help/ai-agents-permissions/).

## What TKTail reads and writes

| Object | Shape | Check it with |
|---|---|---|
| Format profile | the profile file's JSON - JSON Schema, docs/CUSTOM_FORMATS.md | `tktail_validate_format`, `tktail_preview_format` |
| Search | a `SearchDefinition`: `sources` + `predicate` (text, regex, fields, time), optionally a `sequence` - docs/SEARCH.md "Schema" | `tktail_search` (it says what ran in `definition`) |
| Metric Set | `name`, `metrics`: `{object, counter, instance}` in English, as `tktail_list_metrics` shows them | `tktail_save_metric_set` refuses an unknown counter |
| Alert | the alert file's JSON - `name`, `severity`, `condition` (a search definition), `trigger`, `actions`, `capture` - docs/ALERTS.md; `tktail_get_alert` shows a saved one as `alert` | `tktail_validate_alert` |
| Evidence | `evidenceRef` objects from records, results and contexts; incidents and their evidence pages | `tktail_get_record`, `tktail_get_occurrence_evidence` |

The authoritative check is always TKTail's own: the JSON Schema helps an editor or a generator, the validation tools
also check patterns, conditions and references.

## Paging and partial results

- Long lists come in pages: `offset` / `maxResults` (or `limit`), `nextOffset`, `hasMore`; metric history with
  `nextFrom`. Every answer stays within 256 KiB of structured content.
- Cut values say so (`truncated`, the original length). A search that could not look at everything has
  `evidenceMayBeMissing: true` and its state (`incomplete`, `cancelled`, `failed`) with the reason - report it,
  never present such a result as complete.
- An incident's evidence item has its own state (`complete`, `partial`, `failed`) and reason.

## Recipes

Explaining an error, tracing a request across logs, reading an incident and setting up monitoring, writing a format
profile for an unknown log, and reading metrics around a time: [Investigation playbooks](https://tktail.dev/help/ai-agents-playbooks/). To
change a saved alert, search or Metric Set, read it first (`tktail_get_alert`, `tktail_get_saved_search`,
`tktail_get_metric_set`) and pass its `version` as `expectedVersion` (a Metric Set: its `contentId` as
`expectedContent`).

Agents that read documentation before they connect: [AI agents](https://tktail.dev/help/ai-agents/) - `llms.txt`, `llms-full.txt`, the AI
manifest, the machine-readable tool reference and the AI Agent Harness of each release. The authority stays the server
itself: `tools/list` (every tool with its description and input schema) and the `instructions` of `initialize`.

---

Source: https://tktail.dev/help/ai-agents-quickstart/

# Agent quickstart

Every investigation with TKTail follows one loop: discover what is there, inspect the record in question, narrow the
evidence with TKTail's search, correlate it across sources and time, and report it with its source and position. The
calls below are complete `tools/call` parameters - the tool's `name` and its `arguments`, checked against the tools
TKTail serves; replace the values in angle brackets with what TKTail returned. Connecting first: [Turn it
on](https://tktail.dev/help/mcp/#turn-it-on), [Connect any MCP client](https://tktail.dev/help/mcp-clients/).

## 1. Discover

Ask TKTail what it is and what is open - never guess paths or ids.

```json
{ "name": "tktail_status", "arguments": {} }
```

`tktail_status` names the version, the edition and what the license allows (`license`, `features`), whether a TKTail
window answers (`connection`), the investigation scope (`investigationScope`: `safeWorkspace`, or
`safeWorkspace+extended` with Investigation Roots) and the limits of the answers. Without a window (`connection.mode`
`standalone`) only status, formats and samples you send can be answered: ask the user to start TKTail and open the logs.

```json
{ "name": "tktail_list_sources", "arguments": {} }
```

The open logs, event logs and Metrics Views, each with a `sourceId` (`src-...`), its format, size and time range. Ids
and evidence references are valid while that TKTail runs: list again after a restart.

## 2. Inspect

Start from what the user is looking at, then widen around it.

```json
{ "name": "tktail_get_current_context", "arguments": {} }
```

The current record of the view in front - the whole multi-line entry, its time, fields and Summary, and an
`evidenceRef`. `contextKind` `none`: nothing is selected - ask the user to click into a log.

```json
{ "name": "tktail_get_records_around", "arguments": { "anchor": "current", "before": 10, "after": 10 } }
```

The records before and after it, in the order of the source. Any `evidenceRef` TKTail returned works as the anchor -
pass it back unchanged. One whole record: `tktail_get_record` with that `evidenceRef`.

## 3. Narrow

Search with TKTail instead of reading files: a field condition where the format has the field, text or a regular
expression otherwise, a time range when the question has one.

```json
{
  "name": "tktail_search",
  "arguments": {
    "definition": {
      "sources": [{ "kind": "open" }],
      "predicate": { "all": [{ "field": { "name": "requestId", "op": "eq", "value": "<request id>" } }] }
    },
    "maxResults": 50
  }
}
```

The answer has a `searchId`, its `state`, counts and the first results, each with an `evidenceRef`. A search still
running continues in TKTail: `tktail_get_search` waits for it, `tktail_get_search_results` pages through every result
(`offset`, `nextOffset`, `hasMore`). The search is listed in the user's Search Results, marked AI.

```json
{ "name": "tktail_get_search_results", "arguments": { "searchId": 19, "offset": 50, "maxResults": 50 } }
```

Ask for what the question needs, not for every record:

- **How many?** - `"maxResults": 0`: the counts only.
- **Which values?** - `"fields": ["c-ip", "cs-uri-stem", "sc-status"], "preview": false`: each result with only those
  fields (`values`, null where a record has none) - a page of 100 results stays small.
- **Who, how often, how slow?** - `"aggregate"` in `tktail_search`: the search groups, counts and sums EVERY match as it
  finds it - also the matches beyond the 5,000 results it stores - and the answer's `aggregate` has the top groups, a
  histogram and number summaries: a few kilobytes instead of thousands of records. For a question after the search,
  `tktail_aggregate` analyzes the results it stored (`covers: storedResults`).

```json
{
  "name": "tktail_search",
  "arguments": {
    "definition": { "sources": [{ "kind": "open" }], "predicate": { "all": [{ "field": { "name": "sc-status", "op": "ge", "value": "500" } }] } },
    "maxResults": 0,
    "waitMs": 5000,
    "aggregate": { "groupBy": ["c-ip"], "top": 10, "bucket": "1m", "number": "time-taken" }
  }
}
```

```json
{
  "name": "tktail_aggregate",
  "arguments": {
    "searchId": 19,
    "groupBy": ["c-ip"],
    "top": 10,
    "bucket": "1m",
    "number": "time-taken"
  }
}
```

A key or the number is a field name, or a value mapping as in sequence correlation - for a log without that field:
`{"input": "text", "extract": "regex", "pattern": "elapsed: (?<ms>\\d+(\\.\\d+)?)ms", "group": "ms"}`. Read `covers`,
`complete` and `caveats` before you report: `aggregate` in a search covers every match (`allMatches`);
`tktail_aggregate` covers the results the search **stored** (5,000 by default), and rows whose log changed since the
search are `unreadable`; more than 10,000 distinct keys are counted, not grouped. Each top group has
`firstResultIndex` and an `evidenceRef` to show the user. The histogram lists every bucket that has rows: one-minute
buckets over a day of log are more than a thousand entries (1,620 buckets were a 79,000-character answer, which an AI
client may set aside instead of reading). For "the busiest minutes", group by the minute with `top` - a key
`{"input": "field", "field": "time", "extract": "substring", "index": 0, "length": 5, "name": "minute"}` for IIS - or
use a coarser `bucket` (`1h`). A number condition finds the rows themselves:
`{"number": {"input": "text", "extract": "regex", "pattern": "elapsed: (?<ms>\\d+(\\.\\d+)?)ms", "group": "ms", "op": "ge",
"value": 1000}}` inside the predicate.

## 4. Correlate

Relate evidence in time and across sources: the records around a result, the records near a time, a sequence of steps
tied by a key, the metrics of the same minute.

```json
{ "name": "tktail_get_records_around", "arguments": { "sourceId": "<sourceId>", "time": "2026-10-08T10:00:01", "beforeSeconds": 30, "afterSeconds": 30, "indexTimes": true } }
```

The records within 30 seconds of a time - with `time` alone, the record nearest it, as **Edit > Go To Time** finds it.
A time needs the file's record times: until TKTail has read them the answer is `time_not_indexed`, and
`"indexTimes": true` lets TKTail read them in the background (as **View > Read the File's Times**) - while it does, the
answer is `time_indexing`: ask again shortly.
A **sequence search** relates steps in time - X, then within a window Y, tied by a key such as a request id: [A request:
where did it fail?](https://tktail.dev/help/ai-agents-playbooks/#a-request-where-did-it-fail). Metrics of the same time (Trial and Pro):
[Performance](https://tktail.dev/help/ai-agents-playbooks/#performance-what-did-the-machine-do).

## 5. Report

- Quote evidence with its source and position (the source name, the line, the record's own time) and keep the
  `evidenceRef` with it, so the user - or the next call - can go back to it.
- Say when evidence may be missing: a search with `evidenceMayBeMissing: true` or a state `incomplete`, `cancelled` or
  `failed`, a value marked `truncated`, an incident item that is `partial`. Never present such a result as complete.
- Name the TKTail that answered by the answer's own `source` - `nodeId` (this TKTail's data folder) and `instanceId`
  (this run) - never by an earlier call: a restart is a new run, another computer another node. `displayName`,
  `nodeName` and `instanceName` are labels, not keys; an incident's `origin` is the run that captured it, which may not
  be the one answering ([Which TKTail answered](https://tktail.dev/help/mcp/#which-tktail-answered)).
- Propose changes; make them only with the user's consent and the permission they need
  ([Agent permissions](https://tktail.dev/help/ai-agents-permissions/)).

## Rules for agents

- Read what is there before writing; never invent paths - use `tktail_list_sources`, and with Extended Investigation
  `tktail_list_investigation_roots` / `tktail_discover_files`.
- Ask the user before any change. Writing tools are annotated `readOnlyHint: false`; check first with
  `tktail_validate_format` and `tktail_validate_alert` - they need no permission and write nothing.
- On a refusal, tell the user what it says and what they can do - do not retry the same call
  ([Refusals](https://tktail.dev/help/ai-agents-permissions/#refusals)).
- Stay within the bounds: count, project or aggregate before you page; page long results instead of asking for
  everything; every answer stays within 256 KiB.
- TKTail has no tool for commands, programs, settings, or files outside its stores and the Investigation Roots - do not
  look for one.

---

Source: https://tktail.dev/help/ai-agents-permissions/

# Agent permissions

What an agent may read and change is decided by TKTail at every call, by choices only the user makes in TKTail. A
prompt, a configuration file, this documentation or the AI Agent Harness grants nothing: an agent that has all of them
still gets nothing until the user allows it in TKTail - and loses it the moment the user turns it off.

## What decides access

| Layer | Set by | What it decides |
|---|---|---|
| A running TKTail window | the user starts TKTail | Without one, the MCP server answers on its own: status, the formats and samples the agent sends - no sources. |
| **Allow AI access (MCP)** | the user: Settings > AI Access (MCP), or Tools > Allow AI Access (MCP) | Every tool that reads the window's sources. Off by default; turned off, the next call is refused. |
| The transport | the user's client configuration; HTTP also **Accept AI clients over HTTP** | stdio: every edition, the user's own Windows account. HTTP: Trial and Pro, off by default, a token on every request, this computer only unless the user chose the network. |
| The scope | the user: the tabs open in TKTail; **Tools > AI Investigation Roots...** | The Safe Workspace - what is open - for every edition; folders the user approved (Extended Investigation) for Trial and Pro. Never a path the agent invents, `..`, or a link out of an approved folder. |
| Permissions for changes | the user: three settings under **What AI clients may change** | Saving format profiles; saving and deleting Saved Searches and Metric Sets; managing alerts. Each off by default and only together with AI access. |
| The edition | the license | Metrics, Extended Investigation and HTTP are included with Trial and Pro ([Pricing](https://tktail.dev/pricing/)). |

The user sees what an agent did: its searches in Search Results (marked AI) and Jobs, its changes in Manage Alerts,
Saved Searches and the Metric Sets, and one line per answer in Output > Application - never the content
([What TKTail records](https://tktail.dev/help/mcp/#what-tktail-records)).

## Read-only and changing tools

Every tool reads, except those that change data - each of them needs its own permission and is annotated
`readOnlyHint: false`, so a client asks the user before calling it. Every tool needs AI access; the table lists what
some need beyond it, generated from the [MCP tool reference](https://tktail.dev/help/mcp-tools/) of this release.

| Tool | Changes data | Beyond AI access it needs | Note |
|---|---|---|---|
| `tktail_status` |  |  | answers without a running window |
| `tktail_list_instances` |  |  | answers without a running window |
| `tktail_list_sources` |  |  | answers without a running window |
| `tktail_get_current_context` |  |  | answers without a running window |
| `tktail_open_source` |  | Trial or Pro (Extended AI investigation (MCP)) | opens the file as a paused tab in the window |
| `tktail_get_records_around` |  |  | indexTimes: true starts a background time index of the source |
| `tktail_search` |  | a folder scope below an Investigation Root: Trial or Pro | starts an AI search session, shown in Search Results and Jobs (at most 5 kept) |
| `tktail_cancel_search` |  |  | stops one of the client's own searches (the user's searches answer not_allowed) |
| `tktail_list_saved_searches` |  |  | answers without a running window |
| `tktail_run_saved_search` |  |  | starts a new AI search session from a copy of the Saved Search |
| `tktail_save_search` | yes | *Allow AI to save searches and Metric Sets*; paths below an Investigation Root: Trial or Pro |  |
| `tktail_delete_saved_search` | yes | *Allow AI to save searches and Metric Sets* |  |
| `tktail_validate_alert` |  | a metric alert or metric evidence: Trial or Pro |  |
| `tktail_save_alert` | yes | *Allow AI to manage alerts*; a metric alert or metric evidence: Trial or Pro |  |
| `tktail_set_alert_enabled` | yes | *Allow AI to manage alerts* |  |
| `tktail_delete_alert` | yes | *Allow AI to manage alerts* |  |
| `tktail_pin_search` | yes | *Allow AI to save evidence and pin searches* | pins or unpins a search: a pinned search is never closed to make room and is kept across a restart (a snapshot of its references in the data folder); an AI client cannot unpin the user's pin |
| `tktail_save_evidence` | yes | *Allow AI to save evidence and pin searches*; correlatedMetricSets: Trial or Pro; a destination folder below an Investigation Root: Trial or Pro | writes a redacted evidence package (a ZIP) into the Evidence Store (the data folder's Evidence folder), within its size limits; with destination also a copy below an Investigation Root |
| `tktail_delete_evidence` | yes | *Allow AI to save evidence and pin searches* | records a deletion REQUEST in the Evidence Store's catalog and tells the user; nothing is deleted until the user confirms it in TKTail |
| `tktail_list_metrics` |  | Trial or Pro (Performance counters (Metrics)) |  |
| `tktail_get_metric_current` |  | Trial or Pro (Performance counters (Metrics)) |  |
| `tktail_get_metric_history` |  | Trial or Pro (Performance counters (Metrics)) |  |
| `tktail_get_metric_summary` |  | Trial or Pro (Performance counters (Metrics)) |  |
| `tktail_list_metric_sets` |  | Trial or Pro (Performance counters (Metrics)) |  |
| `tktail_get_metric_set` |  | Trial or Pro (Performance counters (Metrics)) |  |
| `tktail_save_metric_set` | yes | *Allow AI to save searches and Metric Sets*; Trial or Pro (Performance counters (Metrics)) |  |
| `tktail_delete_metric_set` | yes | *Allow AI to save searches and Metric Sets* |  |
| `tktail_list_formats` |  |  | answers without a running window |
| `tktail_get_format` |  |  | answers without a running window |
| `tktail_detect_format` |  |  | answers without a running window |
| `tktail_preview_format` |  |  | answers without a running window |
| `tktail_new_format_draft` |  |  | answers without a running window |
| `tktail_validate_format` |  |  | answers without a running window |
| `tktail_save_format` | yes | *Allow AI to save custom formats* |  |
| `tktail_list_investigation_roots` |  | to see the roots (without it the answer says Extended Investigation is not available): Trial or Pro |  |
| `tktail_discover_files` |  | Trial or Pro (Extended AI investigation (MCP)) |  |

Every other tool (14 of 50) reads the window's sources with AI access alone: `tktail_get_source_sample`, `tktail_get_record`, `tktail_get_search`, `tktail_get_search_results`, `tktail_aggregate`, `tktail_get_saved_search`, `tktail_list_alerts`, `tktail_get_alert`, `tktail_list_alert_occurrences`, `tktail_get_alert_occurrence`, `tktail_get_occurrence_evidence`, `tktail_list_evidence`, `tktail_get_evidence`, `tktail_verify_evidence`.

## Refusals

A refusal is a tool result with `isError: true` and `structuredContent.error` `{category, message}`; the message says
what the user can do. Tell the user - do not retry the same call, and never work around it.

| Category | Meaning |
|---|---|
| `invalid_arguments` | an argument is missing, of the wrong type or unknown |
| `access_off` | the user has not allowed AI access (mcp.allowWindow) |
| `capability_unavailable` | the license does not include the capability (Metrics, Investigation Roots, HTTP) |
| `unavailable` | no running TKTail window, not the Primary, or it is closing |
| `busy` | the window did not answer in time, or a bound was reached - retry later |
| `source_not_found` | no open source with this sourceId |
| `stale_source` | the reference belongs to an older state of the source |
| `not_found` | no such search, saved search, metric set, format, event or metric |
| `no_context` | nothing is selected in the window |
| `scope_not_allowed` | the path is neither an open source nor below an approved Investigation Root |
| `unsupported` | the source kind cannot answer this (e.g. a Metrics View as a record source) |
| `not_allowed` | the user's consent for this change is off, or the object is the user's own |
| `conflict` | the stored version or content changed - read it again |
| `time_not_indexed` | the source has no time index yet (indexTimes starts one) |
| `time_indexing` | the time index is being built |
| `no_record_times` | the source's records have no timestamps |
| `response_too_large` | the answer exceeds the response budget - ask for fewer items |
| `internal` | an unexpected failure |

Protocol errors (a malformed request, an unknown method or tool, an unsupported protocol revision) are JSON-RPC errors
instead - their codes are in the developer reference (docs/MCP.md).

## What no permission allows

- Running commands, programs, scripts or a terminal; reading the registry, services or settings; changing settings.
- Reading, listing or writing files outside the sources open in TKTail, the Investigation Roots and TKTail's own stores
  (format profiles, Saved Searches, Metric Sets, alerts).
- Adding, enabling or removing an Investigation Root - only the user does that.
- Deleting, acknowledging or exporting incidents; changing a built-in format, a built-in Metric Set or a `.tktail` file.
- Starting collection of performance counters TKTail does not already collect.
- Overwriting the user's changes: a change names the version it read and is refused (`conflict`) if the object changed.

---

Source: https://tktail.dev/help/ai-agents-playbooks/

# Investigation playbooks

Five investigations an agent is asked for most, each as the user would ask and as the calls the agent makes. They
follow the [Agent quickstart](https://tktail.dev/help/ai-agents-quickstart/) loop; every call is a complete `tools/call` parameter object,
checked against the tools TKTail serves - replace the values in angle brackets with what TKTail returned. The prompts
are examples of what users say; any wording works.

## A request: where did it fail?

> *"Find every record of request R1 and tell me where it failed."*
>
> *"Did a request in payments.log fail in orders.jsonl within 10 seconds?"*

1. **Discover** - the open sources and their formats: does a format have a `requestId` field, or is the id only in the
   text?

   ```json
   { "name": "tktail_list_sources", "arguments": {} }
   ```

2. **Narrow** - one search over every open source: the field where the format has it, the text where it does not.

   ```json
   {
     "name": "tktail_search",
     "arguments": {
       "definition": {
         "sources": [{ "kind": "open" }],
         "predicate": { "any": [
           { "field": { "name": "requestId", "op": "eq", "value": "<request id>" } },
           { "text": "requestId=<request id>" }
         ] }
       },
       "maxResults": 50,
       "withFields": true
     }
   }
   ```

3. **Inspect** - the records around the error result (its `evidenceRef`, or its source and line):

   ```json
   { "name": "tktail_get_records_around", "arguments": { "sourceId": "<payments sourceId>", "line": 2, "before": 5, "after": 5 } }
   ```

4. **Correlate** - the relationship in time, as a sequence: a request received in one log, an error for the same request
   in another within 10 seconds.

   ```json
   {
     "name": "tktail_search",
     "arguments": {
       "definition": {
         "sources": [{ "kind": "source", "path": "<payments sourceId>" }, { "kind": "source", "path": "<orders sourceId>" }],
         "predicate": { "all": [] },
         "sequence": {
           "steps": [
             { "sources": [0], "predicate": { "all": [{ "text": "Request received" }] } },
             { "sources": [1], "predicate": { "all": [{ "field": { "name": "level", "op": "eq", "value": "ERROR" } }] },
               "window": { "after": "previous", "earliestMs": 0, "latestMs": 10000 } }
           ],
           "correlation": [
             { "name": "requestId", "compare": "exact", "steps": [
               { "input": "message", "extract": "after", "text": "requestId=" },
               { "input": "field", "field": "requestId" }
             ] }
           ],
           "policy": "earliest"
         }
       }
     }
   }
   ```

5. **Report** - each sequence's members in order with their times and sources; say if the search was incomplete.

## An alert: what happened, and watching for it

> *"What happened in the last Payment errors incident?"*

1. The alerts and the newest incident of one of them:

   ```json
   { "name": "tktail_list_alerts", "arguments": {} }
   ```

   ```json
   { "name": "tktail_list_alert_occurrences", "arguments": { "alertNumber": 3, "limit": 1 } }
   ```

2. The incident and the evidence it kept - the trigger record, the records before and after it, events, metric
   samples - each item with its own state:

   ```json
   { "name": "tktail_get_alert_occurrence", "arguments": { "occurrenceId": "<occurrenceId>" } }
   ```

   ```json
   { "name": "tktail_get_occurrence_evidence", "arguments": { "occurrenceId": "<occurrenceId>", "item": 1, "limit": 20 } }
   ```

3. Report what fired, when, and what the evidence shows; an item that is `partial` or `failed` says why.

> *"Watch orders.jsonl for ERROR records and keep the records around each one."*

Saving needs the user's permissions *Allow AI to save searches and Metric Sets* and *Allow AI to manage alerts*;
without them, validate and give the alert to the user to create in Manage Alerts.

1. Check the alert with TKTail - this writes nothing and needs no permission:

   ```json
   {
     "name": "tktail_validate_alert",
     "arguments": {
       "alert": {
         "name": "Order errors",
         "severity": "error",
         "condition": {
           "sources": [{ "kind": "source", "path": "<orders sourceId>" }],
           "predicate": { "all": [{ "field": { "name": "level", "op": "eq", "value": "ERROR" } }] }
         },
         "trigger": { "kind": "everyMatch" },
         "actions": ["notify"],
         "capture": { "items": [{ "kind": "file", "recordsBefore": 5, "recordsAfter": 5 }] }
       }
     }
   }
   ```

2. With the user's consent, save the same `alert` with `tktail_save_alert`, and the condition as a Saved Search:

   ```json
   {
     "name": "tktail_save_search",
     "arguments": {
       "name": "Order errors",
       "definition": {
         "sources": [{ "kind": "source", "path": "<orders sourceId>" }],
         "predicate": { "all": [{ "field": { "name": "level", "op": "eq", "value": "ERROR" } }] }
       }
     }
   }
   ```

3. To change a saved one later, read it first (`tktail_get_alert`, `tktail_get_saved_search`) and pass its `version` as
   `expectedVersion` - a change to something the user edited since is refused, never overwritten.

## An unknown format: why is this plain text?

> *"Why is this log shown as plain text? Write a format for it."*

1. How TKTail chose the format, and what the detector saw:

   ```json
   { "name": "tktail_detect_format", "arguments": { "sourceId": "<sourceId>" } }
   ```

2. A sample of the log's records as TKTail frames them:

   ```json
   { "name": "tktail_get_source_sample", "arguments": { "sourceId": "<sourceId>", "records": 20 } }
   ```

3. A draft profile fitted to the log (`delimited` for CSV-like logs, `lineBased` or `multiline` otherwise), then the
   profile with the fields named and given their roles - checked, and previewed on the log's own records until every
   record parses:

   ```json
   { "name": "tktail_new_format_draft", "arguments": { "sourceId": "<sourceId>", "template": "lineBased" } }
   ```

   ```json
   {
     "name": "tktail_validate_format",
     "arguments": {
       "definition": {
         "schemaVersion": 1,
         "id": "orders.worker",
         "name": "Orders worker",
         "framing": { "kind": "line" },
         "envelope": { "pattern": "^(?<timestamp>\\S+ \\S+) (?<level>[A-Z]+) (?<body>.*)$" },
         "fields": [
           { "id": "timestamp", "group": "timestamp", "type": "timestamp", "role": "timestamp" },
           { "id": "level", "group": "level", "role": "severity" },
           { "id": "body", "group": "body", "role": "message" }
         ]
       }
     }
   }
   ```

   A `delimited` draft has the log's delimiter, quote and header and one field per column (`columns` lists them,
   1-based): give the time column `"role": "timestamp"` and `"type": "timestamp"`, the others `"role": "severity"`,
   `"role": "message"`, and rename ids freely. `tktail_preview_format` takes the same `definition` with the `sourceId`
   and shows each record as the profile parses it.

4. With the user's consent and *Allow AI to save custom formats*: `tktail_save_format` with the `definition` and
   `applyToSourceId`; to have the file use it after a restart, put its file name in `definition.fileMatch.names` before
   saving (`["export-*.csv"]`). Without the permission, give the profile to the user to import in the Custom Format
   Studio ([Your own log formats](https://tktail.dev/help/custom-formats/)).

## Performance: what did the machine do?

> *"What did CPU, memory and disk do in the minute around this error?"*

Metrics are included with Trial and Pro, and TKTail reports only what it collects: a Metric Set or a Metrics View must
be open (**View > Metrics...**) - the agent never starts collection.

1. The metrics TKTail collects or still keeps:

   ```json
   { "name": "tktail_list_metrics", "arguments": {} }
   ```

2. Minimum, average and maximum around the error's time, the peak with its time, and every gap:

   ```json
   { "name": "tktail_get_metric_summary", "arguments": { "around": { "time": "2026-10-08T10:00:01", "seconds": 60 } } }
   ```

3. The samples of one metric over the same interval, if the summary shows a peak worth a closer look:

   ```json
   { "name": "tktail_get_metric_history", "arguments": { "metricId": "<metricId>", "around": { "time": "2026-10-08T10:00:01", "seconds": 60 } } }
   ```

4. Report the values with the metric's unit and say where samples were missing - a reading TKTail could not take is
   missing, never zero.

## Evidence: keep it before the log rotates

> *"Save these results with 20 records of context before the log rotates."*
>
> *"Pin this search and preserve its evidence - include orders.jsonl for the same seconds."*

A busy log may keep only minutes of history. Preserve what explains the problem as soon as it is found - never copy a
whole log with a shell command. Saving and pinning need *Allow AI to save evidence and pin searches* (off until the user turns it on - a refusal
`not_allowed` says so: ask the user); TKTail redacts
secrets before anything is written, and everything read back is the redacted package.

1. The search whose results are the evidence (or a `searchId` the investigation already has):

   ```json
   { "name": "tktail_search", "arguments": { "definition": { "sources": [{ "kind": "open" }], "predicate": { "all": [{ "text": "Payment failed" }] } }, "maxResults": 20 } }
   ```

2. Pin it while the investigation goes on - kept across restarts and outside the limit of five AI searches (a pin keeps
   references; only a package keeps the bytes):

   ```json
   { "name": "tktail_pin_search", "arguments": { "searchId": 19 } }
   ```

3. Preserve: the hits' records with 20 records on each side (a stack trace is one record), and the other log for the
   same seconds. The answer names the package, its SHA-256, the time range and how many secrets were redacted; a source
   that rotated before it could be read is reported, never guessed:

   ```json
   {
     "name": "tktail_save_evidence",
     "arguments": {
       "searchId": 19,
       "contextRecordsBefore": 20,
       "contextRecordsAfter": 20,
       "contextTimeBeforeMs": 15000,
       "contextTimeAfterMs": 15000,
       "correlatedSourceIds": ["<orders sourceId>"],
       "note": "payment timeouts before the outage"
     }
   }
   ```

4. Check what was kept - the manifest summary, then a page of the parsed records of the first source (`fields` returns
   only the fields named):

   ```json
   { "name": "tktail_get_evidence", "arguments": { "packageId": "<packageId>", "maxHits": 10 } }
   ```

   ```json
   { "name": "tktail_get_evidence", "arguments": { "packageId": "<packageId>", "artifact": "sources/source-001/records.jsonl", "maxBytes": 4096 } }
   ```

5. Verify before it is shared - VALID, MODIFIED, INCOMPLETE or UNSUPPORTED, also after the original log is gone:

   ```json
   { "name": "tktail_verify_evidence", "arguments": { "packageId": "<packageId>" } }
   ```

6. Report the package id, its SHA-256, the time range and the redactions; the user makes a shareable copy or links it
   to an incident in the Evidence Library ([Saving evidence](https://tktail.dev/help/saving-evidence/)). Deleting a package is a request
   (`tktail_delete_evidence`) the user confirms - ask first.

---

Source: https://tktail.dev/help/mcp-tools/

# MCP tool reference

Every tool an AI client sees when it connects to TKTail (`TKTail.exe mcp --stdio`). What they are for, how to turn AI access on and what an assistant can and cannot reach: [AI integration (MCP)](https://tktail.dev/help/mcp/). Tools only read, except those marked *Changes data* - each kind needs its own permission ([What AI clients may change](https://tktail.dev/help/mcp/#what-ai-clients-may-change)). Every answer, an error too, starts with `source`: the TKTail that produced it - its node and run ([Which TKTail answered](https://tktail.dev/help/mcp/#which-tktail-answered)). The same reference for agents and tools, as JSON: [/ai/mcp-tools.json](https://tktail.dev/ai/mcp-tools.json) ([AI agents](https://tktail.dev/help/ai-agents/)).

50 tools.

## Status and sources

### `tktail_status`

Call this first. Tells which TKTail you are connected to and what it can do now: version and build, whether a TKTail window answers (its open logs and current context are available) or this is a standalone process with no window, the instance and its role, the license edition and its capabilities, whether Windows Event Log and Metrics are available, how many sources are open, and the size limits of the answers; broker: which TKTail carries answers (the main window for its group) and over which transport. Every answer of every tool starts with source: the TKTail that produced it (nodeId, instanceId). Read-only.

*Read-only · answers without a running TKTail window too*

No arguments.

### `tktail_list_instances`

Lists the windows of this TKTail: the main window (Primary - the one whose state the other tools report) and its linked windows, each with its own source (its node and run - not the main window's), its number, title, the sources it shows and the one in front. Linked windows' current context is not available yet. Read-only.

*Read-only · answers without a running TKTail window too*

No arguments.

### `tktail_list_sources`

Lists the investigation sources open in the TKTail window: log files, Windows Event Logs (channels or saved .evtx files) and Metrics Views (Windows Performance Counters). Each has a sourceId (valid while this TKTail runs), its kind, a display name, semantic capabilities (records, text search, structured fields, semantic time, live, metric samples) and kind-specific metadata - for a file its path, format, encoding, size, the time range of its records as far as already read and how a rotation is followed (rotation: same-name, or a dated series - app_2026-10-14.log then app_2026-10-15.log as one log: its pattern, the LIVE file and the one it moved from, whether this file is a previous one kept open); for an event log its channel or file and its ingestion (LIVE health and lag, rows evicted by retention, events skipped to stay current, gaps in the source, the newest gap markers - known gaps are evidence); for metrics the counters (English names - language-independent), aliases and the interval. No file or event contents. Read-only.

*Read-only · answers without a running TKTail window too*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `kinds` | array |  |  | Only these kinds (default: all). |
| `limit` | integer |  | 1..500 | At most this many sources (default 200). |

### `tktail_get_current_context`

Retrieves the evidence the user is focused on in the TKTail window right now - what they are looking at. For a log file: the source, the caret position (line, column, byte offset) and the whole logical record containing it (a multi-line entry such as a stack trace is one record, also when the caret is on a continuation line): its line range, semantic timestamp, severity, parsed fields with their roles, Summary, text and an evidenceRef. For a Windows Event Log: the selected event's channel, provider, event ID, level, time, process / thread, message and evidenceRef. For a Metrics View: the selected series (English counter name, alias, unit, latest value and quality), the cursor time or selected range. Returns contextKind "none" with a reason when nothing is focused or no TKTail window runs. Next: tktail_get_records_around (what happened before / after), tktail_search (other records with the same request ID). Text and fields are bounded (maxTextBytes, maxFields, maxFieldBytes); what was cut is marked truncated. Read-only.

*Read-only · answers without a running TKTail window too*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `maxTextBytes` | integer |  | 0..65536 | The record's text, at most this many UTF-8 bytes (default 16384; 0: no text). |
| `maxFields` | integer |  | 0..256 | At most this many parsed fields (default 64). |
| `maxFieldBytes` | integer |  | 64..8192 | Each field value, at most this many UTF-8 bytes (default 2048). |

### `tktail_open_source`

Opens a file below an Investigation Root as a TKTail source (a tab the user sees) and returns its sourceId - then its records, records around a line or a time, and searches work as for any open source. Only below an enabled root (the path is checked in its final form: "..", other spellings and links that lead out are refused - scope_not_allowed), never a binary file, never a folder. An open file answers with its sourceId (alreadyOpen).

*Read-only · needs Trial or Pro (Extended AI investigation (MCP)) · opens the file as a paused tab in the window*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `path` | string | yes |  | An absolute file path from tktail_discover_files. |

### `tktail_get_source_sample`

A bounded raw sample of an open log file: its logical records as the format in force frames them (a multi-line entry is one record; Plain Text: one line each), each with its line number, line count, byte offset and raw text - for understanding a log's layout or writing a format profile for it. from: start (default) or end; or line: N. records 1-200 (20), maxRecordBytes 64-16384 (4096), maxBytes 1024-65536 (16384) in all; truncated / reachedStart / reachedEnd say what is missing. Open sources only. Read-only.

*Read-only*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `sourceId` | string | yes |  | An open log file (tktail_list_sources). |
| `from` | string |  | `start` / `end` |  |
| `line` | integer |  | 1.. |  |
| `records` | integer |  | 1..200 |  |
| `maxRecordBytes` | integer |  | 64..16384 |  |
| `maxBytes` | integer |  | 1024..65536 |  |

## Records

### `tktail_get_record`

Retrieves one logical record (one log entry - a multi-line entry such as an exception with its stack trace is one record) or one event, with its line range, semantic time, severity, parsed fields, Summary and bounded text - read exactly as TKTail's RECORD pane reads it. Name it by an evidenceRef (from the current context, a search result or another record), or by a sourceId with a line, a byteOffset (files) or a recordId (events). A line inside a record returns the whole record and says which of its lines was asked for (lineInRecord). A reference made before the file was rotated, truncated or replaced is refused as stale_source - never resolved into other bytes. Only sources open in TKTail. Read-only.

*Read-only*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `evidenceRef` | object |  |  | A record or event reference exactly as TKTail returned it (current context, a search result, another record) - pass it back unchanged. |
| `sourceId` | string |  |  | An open source (tktail_list_sources), with line, byteOffset or recordId. |
| `line` | integer |  | 1.. | A 1-based line of a file: the record containing it. |
| `byteOffset` | integer |  | 0.. | A byte position in a file: the record containing it. |
| `recordId` | integer |  | 0.. | An event's EventRecordID (event log sources). |
| `maxTextBytes` | integer |  | 0..65536 | The record's text, at most this many UTF-8 bytes (default 16384). |
| `maxFields` | integer |  | 0..256 | At most this many parsed fields (default 64). |
| `maxFieldBytes` | integer |  | 64..8192 | Each field value, at most this many UTF-8 bytes (default 2048). |

### `tktail_get_records_around`

Retrieves the logical records before and after an anchor - what happened just before and after an error - in the order they are in the source (never re-sorted by time; each record has its own semantic time). The anchor is the user's current record (the default), an evidenceRef (a search result, a record), or a sourceId with a line, byteOffset, recordId or time. With a time, the record nearest that time (as TKTail's Go To Time finds it, out-of-order times included) is the anchor; when TKTail has read only part of the file's times, the answer says so (nearestScope "indexedPart") - "indexTimes": true reads the rest in the background. Each record is compact: evidenceRef, lines, time, severity, title, a few fields and a bounded text (use tktail_get_record for all of one record). With beforeSeconds / afterSeconds (0-3600): the records whose time is within that window of the anchor's (an undated record between is kept; the anchor must have a date and time), at most before / after (default 50) per side - window.completeBefore / completeAfter say whether the window's edge was reached. Bounded: at most 50 per side and the response budget; returnedBefore / returnedAfter, reachedStart / reachedEnd and truncated say what came back. Read-only.

*Read-only · indexTimes: true starts a background time index of the source*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `anchor` | string |  | `current` | The record the user is on (the default when no other anchor is given). |
| `evidenceRef` | object |  |  | A record or event reference exactly as TKTail returned it (current context, a search result, another record) - pass it back unchanged. |
| `sourceId` | string |  |  | An open source, with one of line, byteOffset, recordId or time. |
| `line` | integer |  | 1.. |  |
| `byteOffset` | integer |  | 0.. |  |
| `recordId` | integer |  | 0.. |  |
| `time` | string |  |  | "2026-10-06T04:49:10" (wall clock, as most logs write it) or with "Z" / an offset (an instant). |
| `before` | integer |  | 0..50 | Records before the anchor (default 5). |
| `after` | integer |  | 0..50 | Records after the anchor (default 5). |
| `beforeSeconds` | integer |  | 0..3600 | A time window: the records up to this many seconds before the anchor's time. |
| `afterSeconds` | integer |  | 0..3600 | ... and after it. |
| `maxTextBytes` | integer |  | 0..8192 | Each record's text, at most this many UTF-8 bytes (default 512). |
| `maxFields` | integer |  | 0..64 | Fields per record (default 8). |
| `maxFieldBytes` | integer |  | 64..2048 | Each field value, at most this many UTF-8 bytes (default 256). |
| `indexTimes` | boolean |  |  | With time: let TKTail read the file's remaining record times in the background (default false). |

## Search

### `tktail_search`

Searches the sources open in TKTail with a TKTail search definition - the model of TKTail's Advanced Search, not a query language: "sources" ({"kind":"open"} = every open file and event log; {"kind":"source","path":"&lt;sourceId&gt;"} = one open source; {"kind":"session","session":N} = the results of an earlier search) and a "predicate": {"all":[...]} / {"any":[...]} of {"text":"timeout"} (literal; "case":true matches case), {"regex":"conn(ection)? refused"} (tktail-regex-1: PCRE2 with Unicode, bounded), {"field":{"name":"requestId","op":"eq","value":"ABC123"}} (op: exists eq ne contains startsWith endsWith gt ge lt le missing isNull isNotNull; "case":true), {"time":{"from":"2026-10-06T04:00:00","to":"2026-10-06T05:00:00"}} (wall clock; "Z" for UTC) or {"time":{"last":3600}}. Prefer a field condition when the format has the field (level, requestId, sc-status) - text or regex for free text. SEQUENCES (ordered relationships in time - X, then within a window Y): add "sequence":{"steps":[{"sources":[0],"predicate":{"all":[...]}},{"sources":[1],"predicate":{...},"window":{"after":"previous","earliestMs":0,"latestMs":10000}}],"correlation":[{"name":"requestId","compare":"exact","steps":[{"input":"field","field":"requestId"},{"input":"message","extract":"after","text":"requestId="}]}],"policy":"earliest"} - 2 to 8 steps; a step's sources are indexes of "sources" (none: all); windows are inclusive delays after the previous step's member (latest at most one day); correlation (optional, up to 4 key parts) maps each step's value: input field / message / text (the matched line), extract whole / regex ("pattern" + "group": a named capture) / after ("text") / delimited ("text" + "index") / substring / pathSegment / queryParameter ("name"), normalize trim / lower / upper / removePrefix / number; compare exact / ignoreCase / number. Such a search returns "sequences": each with start, end, durationMs, correlation values and its members in step order (evidenceRef, time, preview) - plus counts of anchors, candidates, comparisons, undated and missingKey items. Starts a search and waits up to waitMs (default 2000) for it: state, counts and the first results, each with an evidenceRef for tktail_get_record / tktail_get_records_around. Still running: tktail_get_search, page with tktail_get_search_results. evidenceMayBeMissing is true unless the search completed with every result stored - incomplete, failed and cancelled searches say why. Folders and paths not open in TKTail are refused (the Safe Workspace) - with Extended Investigation a {"kind":"folder","path":...} below an Investigation Root is searched (links not followed); open a single file first with tktail_open_source. Read-only; the search is listed in TKTail's Search Results, marked AI.

*Read-only · a folder scope below an Investigation Root: Trial or Pro (Extended AI investigation (MCP)) · starts an AI search session, shown in Search Results and Jobs (at most 5 kept)*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `definition` | object | yes |  | A TKTail search definition: {"sources":[{"kind":"open"}],"predicate":{...}} (schemaVersion and regexDialect may be omitted). |
| `waitMs` | integer |  | 0..5000 | Wait up to this long for the search to finish (default 2000). |
| `maxResults` | integer |  | 0..100 | Results in this answer (default 20; 0: none). |
| `withFields` | boolean |  |  | Each file result with its record's severity and first fields (default false). |
| `fields` | array |  | at most 32 items | Projection: each file result with only these fields of its record, as "values" {name: value, or null when the record has none}. |
| `preview` | boolean |  |  | false: no preview text in the results - smaller pages (default true). |
| `aggregate` | object |  |  | Analyze EVERY match as the search finds it (also beyond the results it stores) - the answer's "aggregate", when the search has finished. Members as tktail_aggregate takes them. |

### `tktail_get_search`

Without searchId: the searches TKTail keeps - the user's and AI clients' - newest first, one line each. With searchId: its state (running, completed, incomplete, cancelled, failed), whether evidence may be missing and why, counts (matches found, results stored, sources, records scanned), progress; waitMs waits up to 5 s for a running search; maxResults &gt; 0 adds a page of results. Read-only.

*Read-only*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `searchId` | integer |  | 1.. |  |
| `waitMs` | integer |  | 0..5000 | Wait up to this long for a running search (default 0). |
| `maxResults` | integer |  | 0..100 | Results to include (default 0). |
| `offset` | integer |  | 0.. |  |
| `withFields` | boolean |  |  |  |
| `fields` | array |  | at most 32 items | Projection: each file result with only these fields of its record, as "values" {name: value, or null when the record has none}. |
| `preview` | boolean |  |  | false: no preview text in the results - smaller pages (default true). |

### `tktail_get_search_results`

One page of a search's results (maxResults, default 20, at most 100) from offset - for a sequence search whole sequences (start, end, durationMs, correlation, members in step order), otherwise per result its source, the logical record and the line that matched (files: recordStart, line, the match's bytes; events: record ID, event ID, level, provider), its semantic time, a bounded preview and an evidenceRef - pass it to tktail_get_record or tktail_get_records_around. withFields adds each record's severity and first fields. nextOffset / hasMore page on; a result whose file changed since the search is stale (no evidenceRef). Read-only.

*Read-only*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `searchId` | integer | yes | 1.. |  |
| `offset` | integer |  | 0.. | Default 0. |
| `maxResults` | integer |  | 1..100 | Default 20. |
| `withFields` | boolean |  |  |  |
| `fields` | array |  | at most 32 items | Projection: each file result with only these fields of its record, as "values" {name: value, or null when the record has none}. |
| `preview` | boolean |  |  | false: no preview text in the results - smaller pages (default true). |

### `tktail_cancel_search`

Stops a running search an AI client started - the same as Cancel in TKTail's Jobs; the results found so far stay, the state says cancelled. The user's own searches cannot be cancelled here.

*Read-only · stops one of the client's own searches (the user's searches answer not_allowed)*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `searchId` | integer | yes | 1.. |  |

### `tktail_aggregate`

Analyzes the results a finished search STORED - never a rescan, the same analysis as TKTail's Search Results: "groupBy" up to 4 keys (a field name such as "c-ip" or "sc-status", or a value mapping as in sequence correlation: {"input":"text","extract":"regex","pattern":"user=(?&lt;u&gt;\\w+)","group":"u"}, {"input":"message","extract":"after","text":"tenant="}) gives the top N groups ("top", default 10, at most 1000; "order" count / sum / max / min / avg) with counts, the first result of each (firstResultIndex for tktail_get_search_results, an evidenceRef) and the rows outside the top (otherRows); "bucket" ("1m", "5m", "1h", 1 second to 1 day) adds a time histogram (UTC bucket starts; undated rows counted apart); "number" (a field such as "time-taken" or a mapping, e.g. a regex capture of "elapsed=(?&lt;ms&gt;\\d+)ms") adds count / sum / min / max / avg overall, per group and per bucket - a number is read exactly ("1985.000", "-3", "1e3"; never "1,5" or "12ms": those are notNumbers). A row is a matched line or event (a second match on the same line is mergedMatches, never a second row). Without groupBy, bucket or number: the row count alone (count-only). complete is true only when the search completed with every match stored, every row read again and nothing over a bound - otherwise caveats say what the numbers cover. Waits up to waitMs (default 2000) - still running: call again with "analysisId" alone. Bounded: 10,000 distinct keys (further rows counted as untrackedRows), 10,000 buckets. Read-only.

*Read-only*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `searchId` | integer |  | 1.. | A finished search (tktail_search, tktail_get_search). |
| `analysisId` | integer |  | 1.. | An analysis already started: its answer (alone, with waitMs). |
| `groupBy` | array |  | at most 4 items |  |
| `top` | integer |  | 1..1000 | Groups in the answer (default 10). |
| `order` | string |  | `count` / `sum` / `max` / `min` / `avg` | How the top groups are chosen (default count; the others need a number). |
| `bucket` | string |  |  | A histogram bucket: 1s to 1d ("1m", "5m", "1h"). |
| `number` |  |  |  |  |
| `waitMs` | integer |  | 0..5000 | Wait up to this long for the analysis (default 2000). |

### `tktail_list_saved_searches`

Lists the user's Saved Searches - named, versioned search definitions (sequences included): id, name, description, version, what they look for and where, and whether an AI client may run them (a folder search is outside the Safe Workspace). Run one with tktail_run_saved_search; see its definition with tktail_get_saved_search. Read-only.

*Read-only · answers without a running TKTail window too*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `limit` | integer |  | 1..500 | Default 100. |

### `tktail_get_saved_search`

One Saved Search with its definition - TKTail's search definition JSON, the form tktail_search takes (adapt it and search, or run it as is with tktail_run_saved_search) and its version (the expectedVersion of a change with tktail_save_search). Read-only.

*Read-only*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `id` | string | yes |  |  |

### `tktail_run_saved_search`

Runs a Saved Search as a new search of the open sources - a copy of its current version (the search remembers which Saved Search and version it came from; editing the Saved Search later changes nothing here). Then as tktail_search: state, counts, the first results with evidenceRefs. Read-only.

*Read-only · starts a new AI search session from a copy of the Saved Search*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `id` | string | yes |  |  |
| `waitMs` | integer |  | 0..5000 | Default 2000. |
| `maxResults` | integer |  | 0..100 | Default 20. |
| `withFields` | boolean |  |  |  |
| `fields` | array |  | at most 32 items | Projection: each file result with only these fields of its record, as "values" {name: value, or null when the record has none}. |
| `preview` | boolean |  |  | false: no preview text in the results - smaller pages (default true). |
| `aggregate` | object |  |  | Analyze EVERY match as the search finds it (also beyond the results it stores) - the answer's "aggregate", when the search has finished. Members as tktail_aggregate takes them. |

### `tktail_save_search`

Saves a search definition as a Saved Search (name, description, definition - what tktail_search takes), or changes one (savedSearchId with expectedVersion = the version you read; a newer version is refused: conflict). Only when the user allowed it (Settings &gt; AI Access &gt; Allow AI to save searches and Metric Sets). Its sources must last: open sources ({"kind":"open"} or a sourceId - kept as the file's path), files and folders below an approved Investigation Root - never a search session; a sourceId TKTail follows as a dated series is kept as the series ("series"). Returns savedSearchId and version; an alert can then use the same condition.

*Changes data - needs "Allow AI to save searches and Metric Sets" · paths below an Investigation Root: Trial or Pro (Extended AI investigation (MCP))*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `definition` |  | yes |  |  |
| `name` | string | yes | at most 100 characters |  |
| `description` | string |  |  |  |
| `savedSearchId` | string |  |  |  |
| `expectedVersion` | integer |  | 1.. |  |

### `tktail_delete_saved_search`

Deletes a Saved Search (savedSearchId, expectedVersion = the version you read). Needs Allow AI to save searches and Metric Sets. Alerts made from it keep their own copy of the condition. Ask the user first.

*Changes data - needs "Allow AI to save searches and Metric Sets"*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `savedSearchId` | string | yes |  |  |
| `expectedVersion` | integer | yes | 1.. |  |

## Alerts and incidents

### `tktail_list_alerts`

Lists the user's alerts (TKTail watches files and Windows performance counters for them): alertId, alertNumber, name, enabled, kind (file / metric), severity, version (every saved change of meaning is a new version), the condition and the evidence it keeps in words, whether it is evaluated now (and why not), and its incidents (total, new = unacknowledged, the latest). Investigate an incident with tktail_list_alert_occurrences / tktail_get_alert_occurrence. Read-only; alerts change through tktail_save_alert and its siblings, only when the user allowed AI clients to manage alerts.

*Read-only*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `limit` | integer |  | 1..500 | Default 100. |

### `tktail_get_alert`

One alert with its definition: the condition as TKTail's search definition JSON (the form tktail_search takes), the evidence capture policy, the behavior (intervalMs, cooldownMs - triggers within the cooldown join one incident), a metric alert's live status (conditionTrue: true / false / unknown - an invalid sample is never a value - and the observed value) and its 10 latest incidents. "alert" is the whole definition in the form tktail_validate_alert / tktail_save_alert take (its version is the expectedVersion of a change); madeByAi says an AI client saved it. Read-only.

*Read-only*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `alertId` | string |  |  |  |
| `alertNumber` | integer |  | 0.. |  |

### `tktail_list_alert_occurrences`

The incident history, newest first: each time an alert fired, the occurrence it kept - occurrenceId, the alert, the version that fired, severity, state (capturing: evidence after the trigger still being collected; complete; partial: some evidence is missing, with the reason; failed), triggeredAt (UTC), matchCount (a storm is one incident), acknowledged, pinned, the trigger text, how many evidence items and how many complete. Filters: alertId / alertNumber (a deleted alert's incidents stay), from / to (UTC, triggered within), states, severities or minSeverity (info &lt; warning &lt; error &lt; critical; "error" = error and critical), newOnly, text (in the alert name or trigger). Severity is the alert's when the incident fired (a later edit does not change it). origin: the TKTail node and run that captured it (after a restart not the run answering; unavailable for incidents of an earlier TKTail). Paged: offset, limit (1-100, default 20), total, nextOffset. Listing reads no evidence. Read-only.

*Read-only*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `alertId` | string |  |  |  |
| `alertNumber` | integer |  | 0.. |  |
| `from` | string |  |  | UTC: "2026-10-09T10:00:00Z". |
| `to` | string |  |  |  |
| `states` | array |  |  |  |
| `severities` | array |  |  |  |
| `minSeverity` |  |  | `info` / `warning` / `error` / `critical` | This severity and higher. |
| `newOnly` | boolean |  |  |  |
| `text` | string |  |  |  |
| `offset` | integer |  | 0.. |  |
| `limit` | integer |  | 1..100 |  |

### `tktail_get_alert_occurrence`

One incident: the alert and the version that fired with its condition as it was then (definition JSON), the trigger - the record that matched (its text, semantic time, the match's character ranges, source file, format, encoding) or a metric condition with the observed value and the samples it was decided on - each evidence item (file records, Event Log events, metric samples) with its state, the reason when not complete, its window, counts and notes (rotation, truncation), the capture's diagnostics and its origin (the node and run that captured it). Read the kept evidence with tktail_get_occurrence_evidence. Evidence is what the user's alert asked for - TKTail captured it when the alert fired, it is not re-read. Read-only.

*Read-only*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `occurrenceId` | string | yes |  |  |
| `maxTextBytes` | integer |  | 256..16384 | The trigger record's text, default 4096. |

### `tktail_get_occurrence_evidence`

A page of what one evidence item of an incident kept, in order: records (rel: position relative to the trigger record, -2 = two before it; the trigger marked; time, text, generation: 1 the trigger's file, 2.. files read after a rotation or in a dated series' next file, 0 the series' previous file), events (recordId, time, level, eventId, provider, message) or samples (metric index and label, time UTC, value only when valid, quality), and notes (a generation's note names its file's path when it is another file). Paged: item (1-based, default 1), offset, limit (1-200, default 50), maxTextBytes per text (256-16384, default 4096); total, nextOffset. Read-only.

*Read-only*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `occurrenceId` | string | yes |  |  |
| `item` | integer |  | 1..16 |  |
| `offset` | integer |  | 0.. |  |
| `limit` | integer |  | 1..200 |  |
| `maxTextBytes` | integer |  | 256..16384 |  |

### `tktail_validate_alert`

Checks a proposed alert exactly as saving it would - the definition, the search condition, the sources and evidence it names (open sources, metrics, event log channels, files and folders below an approved Investigation Root - nothing else), the limits, the license (a Performance Counter alert needs Metrics) - and saves nothing. Use it before tktail_save_alert, also when saving is not allowed. alert: the alert file's JSON as tktail_get_alert shows it in "alert" (the schema below lists every member and value). A file alert names its sources by sourceId; when TKTail follows that file as a dated series (tktail_list_sources file.rotation), the alert follows the series - its newest file - and the normalized alert says so ("series"); give "series" yourself for a series TKTail did not detect (u_ex{YYMMDD}.log). A metric alert: a source {kind metric, metric {object, counter, instance}} and {metric:{source:0, op, value, aggregate, windowMs \| forMs}}. Omitted members take defaults. Returns valid, problem, whether the live runtime would evaluate it (notEvaluatedBecause), the normalized alert. The examples are complete.

*Read-only · a metric alert or metric evidence: Trial or Pro (Performance counters (Metrics))*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `alert` |  | yes |  |  |

### `tktail_save_alert`

Creates an alert, or changes one (alertId or alertNumber, with expectedVersion = the version you read - a version the user changed since is refused: conflict). Only when the user allowed it (Settings &gt; AI Access &gt; Allow AI to manage alerts; otherwise not_allowed). Checked as tktail_validate_alert: sources and evidence only from what TKTail may read for AI clients. The alert is saved as the user's alerts are (Manage Alerts shows it at once), marked as made by an AI client; one that needs an Investigation Root is disabled when the user removes that root. The alert keeps its file watched while it is enabled - also without a tab (a dated series: its newest file). Returns alertId, alertNumber, version, whether it is evaluated. Ask the user before saving.

*Changes data - needs "Allow AI to manage alerts" · a metric alert or metric evidence: Trial or Pro (Performance counters (Metrics))*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `alert` |  | yes |  |  |
| `alertId` | string |  |  |  |
| `alertNumber` | integer |  | 1.. |  |
| `expectedVersion` | integer |  | 1.. | Changing an alert: the version you read. |

### `tktail_set_alert_enabled`

Enables or disables an alert (alertId or alertNumber, expectedVersion = the version you read). Needs Allow AI to manage alerts. Disabling stops it at once; its incidents stay.

*Changes data - needs "Allow AI to manage alerts"*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `alertId` | string |  |  |  |
| `alertNumber` | integer |  | 1.. |  |
| `enabled` | boolean | yes |  |  |
| `expectedVersion` | integer | yes | 1.. |  |

### `tktail_delete_alert`

Deletes an alert (alertId or alertNumber, expectedVersion = the version you read). Needs Allow AI to manage alerts. Its incidents and the alert history stay. Ask the user first.

*Changes data - needs "Allow AI to manage alerts"*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `alertId` | string |  |  |  |
| `alertNumber` | integer |  | 1.. |  |
| `expectedVersion` | integer | yes | 1.. |  |

## Evidence

### `tktail_pin_search`

Pins a search (pinned: true, the default) so TKTail never closes it to make room - the AI clients' bound of 5 searches and the session limit apply to unpinned searches only. A pinned search is kept across a TKTail restart (its definition and the references of its results) and stays usable by tktail_aggregate, tktail_get_search_results and tktail_save_evidence while its files still hold the same data. At most 20 searches are pinned; beyond that the pin is refused - unpin one. Pin a search while an investigation continues; save evidence (tktail_save_evidence) when proof must survive the logs rotating or being deleted - a pin keeps references, a package keeps the bytes. An AI client may unpin only searches an AI client pinned. preserveEvidence also saves the results' records as an evidence package at once - the strongest protection against rotation; a pinned search's answer says its protection: preserved, preservationPending, preservationFailed, sourceStillAvailable or sourceDisappeared (never a guarantee TKTail cannot give). keptAcrossRestart: its snapshot is on disk (a finished search's pin is answered once it is written, 3 s at most; a running search's when it finishes). Needs Allow AI to save evidence and pin searches (off until the user turns it on).

*Changes data - needs "Allow AI to save evidence and pin searches" · pins or unpins a search: a pinned search is never closed to make room and is kept across a restart (a snapshot of its references in the data folder); an AI client cannot unpin the user's pin*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `searchId` | integer | yes | 1.. |  |
| `pinned` | boolean |  |  | true (default): pin; false: unpin. |
| `preserveEvidence` | boolean |  |  | Also save the results' records now as an evidence package (redacted), while the files still hold them. |
| `contextRecords` | integer |  | 0..1000 | With preserveEvidence: records kept on each side of a hit (default 20). |

### `tktail_save_evidence`

Preserves evidence as a durable, redacted, verifiable package in TKTail's Evidence Store - only the records that matter, never a copy of a whole log. Name what: "searchId" (all its results, or the result indexes in "results") and / or "evidenceRefs" (from search results, records, incidents). Context around each hit: "contextRecordsBefore" / "contextRecordsAfter" (logical records as the format frames them - a stack trace is one record; at most 1000) and / or "contextTimeBeforeMs" / "contextTimeAfterMs" (by each record's own time). TKTail seeks to the hits' stored byte offsets (no rescan), merges overlapping ranges and keeps the source bytes exactly where nothing was redacted. Correlated sources for the same time window (the hits' span widened by the time context, 15 s when none is given) are named explicitly: "correlatedSourceIds" (other open files and event logs), "correlatedChannels" (Windows event log channels such as "Application"), "correlatedMetricSets" (Metric Set ids - their kept samples). Secrets (Authorization / Bearer headers, JWTs, passwords and connection-string passwords, API keys, private keys and the user's own rules) are redacted BEFORE anything is written - there is no unredacted option. "note" says why; "linkIncidentId" links an incident; "destination" {"folder"} also copies the package below an Investigation Root (Extended Investigation). Waits up to waitMs (default 3000) - still capturing: tktail_get_evidence(packageId) later. Answers packageId, the archive's size and SHA-256, the time range, counts, the source bytes read (sourceBytesRead), the number of redactions and warnings (a source that changed or rotated before it could be read is reported, never guessed; nothing preserved at all is a failure). "fullFileSourceId" saves a whole open file instead (when a vendor asks for the whole log): redacted, compressed while it is read, paced, within the full-file limit - never a copy of a file TKTail does not have open. Needs Allow AI to save evidence and pin searches (off until the user turns it on).

*Changes data - needs "Allow AI to save evidence and pin searches" · correlatedMetricSets: Trial or Pro (Performance counters (Metrics)) · a destination folder below an Investigation Root: Trial or Pro (Extended AI investigation (MCP)) · writes a redacted evidence package (a ZIP) into the Evidence Store (the data folder's Evidence folder), within its size limits; with destination also a copy below an Investigation Root*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `searchId` | integer |  | 1.. | A finished search: its results are the hits. |
| `results` | array |  | at most 5000 items | With searchId: only these result indexes. |
| `evidenceRefs` | array |  | at most 1000 items | evidenceRef objects as TKTail returned them. |
| `contextRecordsBefore` | integer |  | 0..1000 |  |
| `contextRecordsAfter` | integer |  | 0..1000 |  |
| `contextTimeBeforeMs` | integer |  | 0..21600000 |  |
| `contextTimeAfterMs` | integer |  | 0..21600000 |  |
| `correlatedSourceIds` | array |  | at most 16 items | Open files / event logs (tktail_list_sources) for the same window. |
| `correlatedChannels` | array |  | at most 16 items | Windows event log channels by name ("Application"). |
| `correlatedMetricSets` | array |  | at most 8 items | Metric Set ids (tktail_list_metric_sets). |
| `includeParsedRecords` | boolean |  |  | Also records.jsonl - each record parsed, its fields (default true). |
| `note` | string |  | at most 2000 characters |  |
| `linkIncidentId` | string |  |  | An incident's occurrenceId. |
| `destination` | object |  |  | Also copy the package into this folder below an enabled Investigation Root. |
| `waitMs` | integer |  | 0..5000 |  |
| `fullFileSourceId` | string |  |  | An open file (sourceId): the WHOLE file as evidence, redacted and compressed, on its own (no searchId / evidenceRefs) - only when the whole log is really asked for. |

### `tktail_list_evidence`

The evidence packages in TKTail's Evidence Store, newest first (offset / limit 1-100, default 20) and the captures still running: packageId, created, note, sources, time range, size, hits, redacted + replacements, linked incident, the archive's SHA-256, whether an AI client asked to delete it. Metadata only - no evidence content. Read-only.

*Read-only*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `offset` | integer |  | 0.. |  |
| `limit` | integer |  | 1..100 |  |

### `tktail_get_evidence`

One package's manifest as a summary (created by, TKTail version, search, context, time range, redaction summary per rule, sources with their state and notes, hits with their record, line when known and range, artifacts with size and SHA-256, limitations, the archive's path and SHA-256) - and with "artifact" (a path from "artifacts") a bounded fragment of that file: "offset" / "maxBytes" (1024-65536, default 16384, whole lines where possible; nextOffset / hasMore page on). For records.jsonl, "fields" returns only those fields of each record. What is returned is the stored package - redacted when it was captured. A file larger than 64 MiB is not paged: its path is given. A capture still running: the answer waits up to "waitMs" (0-5000, default 3000) for it to be saved, then answers the package - or its progress when the time ran out (call again; no need to wait in between). Read-only.

*Read-only*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `packageId` | string | yes |  |  |
| `artifact` | string |  |  |  |
| `offset` | integer |  | 0.. |  |
| `maxBytes` | integer |  | 1024..65536 |  |
| `fields` | array |  | at most 32 items |  |
| `maxHits` | integer |  | 0..200 |  |
| `waitMs` | integer |  | 0..5000 |  |

### `tktail_verify_evidence`

Reads the package's archive and checks it: its SHA-256 against the one recorded when it was saved, the ZIP structure and CRCs, the manifest's schema, every file's presence, size and SHA-256. Verdict VALID, MODIFIED, INCOMPLETE or UNSUPPORTED (a newer TKTail's package, left as it is) with the problems found. Hashes show the package is unchanged since TKTail wrote it - not who made it. Read-only.

*Read-only*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `packageId` | string | yes |  |  |

### `tktail_delete_evidence`

Asks the user to delete an evidence package: TKTail records the request and shows it in the Evidence Library, where the user confirms or rejects it - an AI client never deletes evidence itself, and the package stays until the user decides. Needs Allow AI to save evidence and pin searches. Ask the user before calling this.

*Changes data - needs "Allow AI to save evidence and pin searches" · records a deletion REQUEST in the Evidence Store's catalog and tells the user; nothing is deleted until the user confirms it in TKTail*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `packageId` | string | yes |  |  |
| `reason` | string |  | at most 500 characters |  |

## Metrics

### `tktail_list_metrics`

Lists every metric TKTail collects or still keeps history of (Windows performance counters the user's Metrics Views and alerts collect): metricId, canonical English name, alias, unit, state (collecting at intervalMs, or stopped - history kept, no current value), the latest sample (time UTC, quality, value only when valid), stale, the retained history span and the Metrics Views showing it. Use a metricId with tktail_get_metric_current / _history / _summary. Read-only.

*Read-only · needs Trial or Pro (Performance counters (Metrics))*

No arguments.

### `tktail_get_metric_current`

A metric's latest sample: time (UTC and this machine's local time), quality (Valid, Warmup, Missing, Denied, Error) and the value with its unit - value is null unless the sample is Valid (never a zero for a missing reading). isCurrent is true only when TKTail collects it now, the sample is valid and not stale; a stopped metric says so. Read-only.

*Read-only · needs Trial or Pro (Performance counters (Metrics))*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `metricId` | string | yes |  | From tktail_list_metrics. |

### `tktail_get_metric_history`

A metric's kept samples in an interval, oldest first: each {t: UTC time, v: value} - v null with q (quality) when the sample has no value; afterGap / processRestarted mark discontinuities. No interpolation: gaps (noSamples, processRestarted, noValue) are listed explicitly. The interval: from (+ to, default now), lastSeconds (default 300), or around {time, seconds} - times like "2026-10-09T10:00:00" (this machine's wall clock, as logs write it) or with "Z" / an offset; at most 24 hours. Bounded: maxSamples (default 300, at most 2000) - truncated / nextFrom page on; for long intervals prefer tktail_get_metric_summary. historyStartsAt says when TKTail's kept history begins (retention). Read-only.

*Read-only · needs Trial or Pro (Performance counters (Metrics))*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `metricId` | string | yes |  | From tktail_list_metrics. |
| `from` | string |  |  | Interval start: "2026-10-09T10:00:00" (local wall clock) or with Z / an offset. |
| `to` | string |  |  | Interval end (default now); only with from. |
| `lastSeconds` | integer |  | 1..86400 | The last N seconds (default 300). |
| `around` | object |  |  | {"time":"2026-10-09T10:00:15","seconds":60}: N seconds on each side of a time (an error's). |
| `maxSamples` | integer |  | 1..2000 | Default 300. |

### `tktail_get_metric_summary`

Summarizes up to 16 metrics over one interval - what CPU, memory and disk did around an error: per metric min / avg / max (raw and formatted with the unit), first / last / delta, the peak and low with their times, valid samples and samples without a value (warmup, missing, denied, error), gaps and gap seconds, and historyStartsAt when the kept history begins later than the interval. Only valid samples count - nothing is assumed for gaps. metricIds: the metrics (default: every metric TKTail keeps, at most 16). The interval as tktail_get_metric_history. Read-only.

*Read-only · needs Trial or Pro (Performance counters (Metrics))*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `metricIds` | array |  | at most 16 items | From tktail_list_metrics (default: all kept, at most 16). |
| `from` | string |  |  |  |
| `to` | string |  |  |  |
| `lastSeconds` | integer |  | 1..86400 |  |
| `around` | object |  |  |  |

### `tktail_list_metric_sets`

Lists the Metric Sets TKTail offers - named groups of Windows performance counters: the built-in ones (Host Basics, System Pressure, Process Diagnostics, Disk & I/O, Network) and the user's own. Each with its id, name, description, how many metrics, its binding (none; a process or an instance chosen when the user applies it), how many of its metrics TKTail collects now and how many Metrics Views show it. TKTail collects only what the user opened - an AI client reads, it never starts collection. Read-only.

*Read-only · needs Trial or Pro (Performance counters (Metrics))*

No arguments.

### `tktail_get_metric_set`

One Metric Set with its metrics: each metric's metricId and canonical English name (object \ counter, instance) - the identity; the alias and this Windows's localized name are display only - its unit (unit for people: "%", "bytes", "bytes/s", "/s", "s", "count"; unitKey / unitKind the canonical word: count, percent, bytes, bytesPerSecond, perSecond, seconds), "definition" - the metric exactly as tktail_save_metric_set and an alert's metric source take it - and whether TKTail collects it now. Read-only.

*Read-only · needs Trial or Pro (Performance counters (Metrics))*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `id` | string | yes |  | A Metric Set id from tktail_list_metric_sets ("builtin:host", "set-..."). |

### `tktail_save_metric_set`

Saves a Metric Set of the user's (name, description, metrics: 1-64 definitions - object, counter, instance in English; provider (pdh) and unit (count / percent / bytes / bytesPerSecond / perSecond / seconds) may be left out: TKTail infers the unit from the counter; a "definition" from tktail_list_metrics / tktail_get_metric_set can be copied as it is), or changes one (metricSetId with expectedContent = its contentId as you read it; built-in sets never change). Needs Allow AI to save searches and Metric Sets, and the Metrics feature (Trial / Pro). A set is what to observe - never samples, and saving one starts no collection; alerts and Metrics Views use it.

*Changes data - needs "Allow AI to save searches and Metric Sets" · needs Trial or Pro (Performance counters (Metrics))*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `name` | string | yes | at most 64 characters |  |
| `description` | string |  |  |  |
| `metrics` | array | yes | at most 64 items |  |
| `metricSetId` | string |  |  |  |
| `expectedContent` | string |  |  | Changing a set: its contentId as you read it. |

### `tktail_delete_metric_set`

Deletes a Metric Set of the user's (metricSetId, expectedContent = its contentId as you read it). Needs Allow AI to save searches and Metric Sets. Built-in sets cannot be deleted. Ask the user first.

*Changes data - needs "Allow AI to save searches and Metric Sets"*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `metricSetId` | string | yes |  |  |
| `expectedContent` | string | yes |  |  |

## Formats

### `tktail_list_formats`

Lists the log formats TKTail knows - favorite (and favoriteOrder) marks the user's favorites: the built-in ones (formatId "builtin:&lt;key&gt;" - JSON Lines, IIS W3C, application logs, syslog, CSV, ...) with their category, family, what works for them (fields, structured search, multi-line records, live) and file extensions; and the user-defined format profiles ("custom:&lt;id&gt;") with enabled, usable, state, profileVersion, framing, record types, field count and error / warning counts. kind: builtin, custom or all (default). Read-only.

*Read-only · answers without a running TKTail window too*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `kind` | string |  | `builtin` / `custom` / `all` |  |

### `tktail_get_format`

One format by formatId. Built-in: its description, capabilities, extensions and notes - immutable (a user-defined profile can be made from a sample). User-defined: its state and diagnostics, field ids and field-schema fingerprint, the profile regex dialect, and its whole definition (the JSON TKTail stores - the form tktail_validate_format and tktail_preview_format take). usedBy: the open sources it is in force for. Read-only.

*Read-only · answers without a running TKTail window too*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `formatId` | string | yes |  | "builtin:&lt;key&gt;" or "custom:&lt;id&gt;" from tktail_list_formats. |

### `tktail_detect_format`

How TKTail decides a log's format, with the actual detector. For an open source (sourceId): the format in force and how it was chosen (View As, a .tktail rule, a profile's file association, detected, fallback), what detection alone would choose, conflicts, the resolution chain, and the detector's candidates with confidence (0-100, level) and evidence - or why each was rejected. For your own text (sample: {text, fileName}): what TKTail would use for such a file (content and file name only). Both list the user-defined profiles whose file name or content rules claim it; with a draft definition, whether its fileMatch would. Read-only.

*Read-only · answers without a running TKTail window too*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `sourceId` | string |  |  |  |
| `sample` | object |  |  |  |
| `definition` | object |  |  | Optional: a draft format profile whose fileMatch to test. |

### `tktail_preview_format`

Runs a format over sample records with TKTail's actual pipeline and shows the result per record: for a profile (a draft definition, or an installed custom:&lt;id&gt;) the Custom Format Studio's preview - framing into records, outcome (match, partial, noMatch), record type (and the candidates with explain or when ambiguous), fallback, every field (id, raw, parsed, type, role, state extracted / missing / notCaptured / conditionFalse / conversionFailed, note), the Summary, issues and slow records; for a built-in (builtin:&lt;key&gt;) the viewer's framing, parse and Summary. Plus totals and the definition's diagnostics. The sample: an open source's records (sourceId, from / line) or your own text (sample: {text, fileName}). maxRecords 1-50 (10), maxFields 1-64 (24), maxFieldBytes 64-2048 (256). Nothing is saved or applied. Read-only.

*Read-only · answers without a running TKTail window too*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `definition` | object |  |  | A draft format profile (JSON). |
| `formatId` | string |  |  | An installed format: builtin:&lt;key&gt; or custom:&lt;id&gt;. |
| `sourceId` | string |  |  |  |
| `from` | string |  | `start` / `end` |  |
| `line` | integer |  | 1.. |  |
| `sample` | object |  |  |  |
| `maxRecords` | integer |  | 1..50 |  |
| `maxFields` | integer |  | 1..64 |  |
| `maxFieldBytes` | integer |  | 64..2048 |  |
| `explain` | boolean |  |  | List every record type's candidate result. |

### `tktail_new_format_draft`

Returns a valid starting definition for a user-defined format profile. With sourceId (an open log): from that log's detected format - a delimited log (CSV comma / semicolon, TAB, pipe) gives its own separator, quoting, header and one field per column (columns numbered from 1, in "columns"), so a profile only gives the columns their meaning (role timestamp / severity / message / correlation ..., type) - one parser, nothing re-implemented. Otherwise from a template: lineBased (one record per line: timestamp, level, message), multiline (records start with a timestamp; following lines such as stack traces belong to them; the default), cloneAppLog (TKTail's built-in application-log shape, declaratively - built-in formats themselves are immutable) or delimited (CSV / TSV / ';' / '\|' columns: framing kind delimited with delimiter, quote, escape doubled / backslash / none, header; fields read columns by number - group 1 is the first column - or by header name). id (3-64: a lowercase letter, then a-z 0-9 . _ -) and name are optional. Nothing is saved: you keep and edit the JSON - envelope.pattern (ECMAScript with (?&lt;name&gt;...) groups), fields (id, group, type text / integer / decimal / boolean / timestamp / durationMs / enum, role timestamp / severity / message / logger / thread / correlation / duration / ..., values), recordTypes (match / extract, fallback), framing (line / multiline with recordStart / delimited with delimiter), fileMatch (extensions, names, content) - then check it with tktail_validate_format and tktail_preview_format against the log's own records.

*Read-only · answers without a running TKTail window too*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `template` | string |  | `lineBased` / `multiline` / `cloneAppLog` / `delimited` |  |
| `id` | string |  |  |  |
| `name` | string |  | at most 100 characters |  |
| `sourceId` | string |  |  | An open log the draft starts from (its detected format). |

### `tktail_validate_format`

Validates a user-defined format profile (a JSON definition: id, name, fileMatch, framing, envelope pattern, fields, recordTypes, severity, presentation - docs CUSTOM_FORMATS) with TKTail's own parser and compiler: schema, ids and references, field types and roles, predicates and every regex (the profile dialect: ECMAScript with (?&lt;name&gt;...) groups, bounded as in the Custom Format Studio). Returns valid, diagnostics (severity, path such as recordTypes[1].match.pattern, message, position in the pattern), the field ids and schema fingerprint, and whether a profile with that id is installed (its version). Nothing is saved. Read-only.

*Read-only · answers without a running TKTail window too*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `definition` | object | yes |  | The format profile JSON. |

### `tktail_save_format`

Saves a user-defined format profile into TKTail's Custom Formats - only when the user allowed AI clients to save formats (Tools &gt; Allow AI to Save Custom Formats; otherwise not_allowed - the user can import the draft in the Custom Format Studio instead). Validate and preview it first: a definition with errors is refused and nothing is written. A new id is saved as version 1; to replace an installed profile pass replacesVersion = its current profileVersion (tktail_get_format) - if it changed since, the save is refused (conflict), never overwritten. TKTail chooses where it is stored; built-in formats are never changed. applyToSourceId puts it in force for that open log (as View As, for this session). Returns the formatId, the new profileVersion, whether the field schema changed (removedFields) and warnings. favorite: true also lists it first among the user's favorite formats - only when the user asked for that. Ask the user before saving.

*Changes data - needs "Allow AI to save custom formats"*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `definition` | object | yes |  | The format profile JSON (validated again before writing). |
| `replacesVersion` | integer |  | 1.. | Replacing an installed profile: its current profileVersion. |
| `applyToSourceId` | string |  |  | An open log file to use the saved profile for (View As, this session). |
| `favorite` | boolean |  |  | Mark it as a favorite format - only when the user asked. |

## Extended Investigation

### `tktail_list_investigation_roots`

Extended Investigation: the folders the user approved for AI investigation beyond what is open in TKTail (Investigation Roots - only the user adds or enables them, in TKTail: Tools &gt; AI Investigation Roots...). Each with its rootId, path, label, enabled and whether it is usable now. extendedInvestigation.available is false without the license capability (Trial and Pro include it) - then only the Safe Workspace (what is open) is searched. Below a usable root: tktail_discover_files, tktail_search with {"kind":"folder","path":...}, tktail_open_source. Read-only.

*Read-only · to see the roots (without it the answer says Extended Investigation is not available): Trial or Pro (Extended AI investigation (MCP))*

No arguments.

### `tktail_discover_files`

Lists the files below an Investigation Root (or a folder below it) that match file masks - as a folder search would take them - each with its path, relative path, size, modified time (UTC), the format TKTail would read it as, binary (skipped by searches; not openable) and its sourceId when it is open. Links (junctions, symbolic links) are never followed or listed. Bounded: maxFiles 1-1000 (200), at most 5,000 folders listed and 10 s; truncated / incomplete / limitReason (maxFiles, maxDirectories, time) say what is missing. include / exclude: "*.log;u_ex*.log", "**\archive\**"; recursive (default true); probe false skips the format probe. Read-only.

*Read-only · needs Trial or Pro (Extended AI investigation (MCP))*

| Argument | Type | Required | Bounds | Description |
|---|---|---|---|---|
| `rootId` | string | yes |  | From tktail_list_investigation_roots. |
| `folder` | string |  |  | An absolute folder below that root (default: the root). |
| `include` | string |  |  |  |
| `exclude` | string |  |  |  |
| `recursive` | boolean |  |  |  |
| `maxFiles` | integer |  | 1..1000 |  |
| `probe` | boolean |  |  |  |

---

Source: https://tktail.dev/help/

# TKTail user guide

TKTail shows huge and growing log files on Windows: it follows new lines as they are
written, finds text in gigabytes without loading them into memory, explains structured
records field by field and warns you when something you care about appears. It keeps the
evidence of an investigation after the logs rotate, and lets an AI assistant investigate with
you through structured, bounded questions - only what you allow.

## Contents

**Start**

| Page | What it covers |
|---|---|
| [Getting started](https://tktail.dev/help/getting-started/) | Opening files, one TKTail for many requests, closing the window, safe mode |
| [System requirements](https://tktail.dev/help/system-requirements/) | The Windows versions TKTail runs on, and which features need a newer Windows or look different on an older one |
| [Viewing logs](https://tktail.dev/help/viewing-logs/) | LIVE and PAUSED, moving around, records and time, selecting and copying, exporting, encodings, record formats (View As), tabs and splits, themes, the status bar |
| [Rotating dated log files](https://tktail.dev/help/rotating-dated-logs/) | Logs whose file name carries the date, time or a number (`app_2026-10-14.log`, then `app_2026-10-15.log`) followed as one log: what is recognized, Auto / On / Off, previous files, alerts, restarts |
| [Search](https://tktail.dev/help/search/) | Find in a file, Find in All Open Files, Advanced Search, sequences, folder searches, regular expressions |
| [Huge files and network shares](https://tktail.dev/help/large-and-network-files/) | Files of many gigabytes; following logs on network shares (refresh modes, offline and back) |
| [Keyboard shortcuts](https://tktail.dev/help/keyboard-shortcuts/) | All shortcuts |

**Sources and formats**

| Page | What it covers |
|---|---|
| [Explorer](https://tktail.dev/help/explorer/) | The left panel: Files (folders, file list, filter, favorites, searching folders) and Windows Event Logs |
| [Windows Event Log](https://tktail.dev/help/windows-event-log/) | Application, System and other event logs: history + LIVE, floods and gaps, filters, find, copy, export |
| [Metrics](https://tktail.dev/help/metrics/) | Windows Performance Counters beside your logs: the Metrics View, Show Metrics Around This Time, the METRICS panel |
| [Built-in formats](https://tktail.dev/help/built-in-formats/) | Every log and data format TKTail reads without setup - generated from the program's format registry |
| [Folder formats (.tktail)](https://tktail.dev/help/local-configuration/) | Tell TKTail which format the logs of a folder (or one file) are |
| [Your own log formats](https://tktail.dev/help/custom-formats/) | Custom format profiles and the Custom Format Studio |

**Investigating**

| Page | What it covers |
|---|---|
| [Inspector](https://tktail.dev/help/inspector/) | The right panel: file facts and the fields of the current record |
| [Bottom panel](https://tktail.dev/help/bottom-panel/) | Record, Search Results, Advanced Search, Output, Problems, Alerts, Incidents, Terminal, System, Jobs |
| [Alerts and monitoring](https://tktail.dev/help/alerts-and-monitoring/) | Alerts, notifications, incidents and their evidence, background monitoring |
| [Saving evidence](https://tktail.dev/help/saving-evidence/) | Evidence packages: keep a search's records with their context, redacted and verifiable, after the logs rotate; the Evidence Library; pinned searches; sharing |

**AI assistance**

| Page | What it covers |
|---|---|
| [AI assistance](https://tktail.dev/help/ai-assistance/) | Investigate with an AI assistant: what it can and cannot do, a quick start, a production incident, permissions, questions |
| [Investigate a production incident](https://tktail.dev/help/ai-production-incident/) | For operations: correlate logs, events and counters with an assistant, preserve the evidence, leave a record the next shift relies on - a worked example |
| [Develop with a coding agent](https://tktail.dev/help/ai-developer-loop/) | For developers: your coding agent reads what the code did after each build and run - a worked example of two builds |
| [AI integration (MCP)](https://tktail.dev/help/mcp/) | Let an AI assistant (e.g. Claude Code) investigate with you - off until you allow it, changes only with your permission |
| [AI agents](https://tktail.dev/help/ai-agents/) | What TKTail offers AI agents, the machine-readable references and the AI Agent Harness of each release |
| [Connect any MCP client](https://tktail.dev/help/mcp-clients/) | stdio and HTTP, protocol revisions, shapes and paging - for clients, frameworks and scripts |
| [Agent quickstart](https://tktail.dev/help/ai-agents-quickstart/) | The investigation loop: Discover, Inspect, Narrow, Correlate, Report |
| [Agent permissions](https://tktail.dev/help/ai-agents-permissions/) | What decides what an agent may read and change, and what each refusal means |
| [Investigation playbooks](https://tktail.dev/help/ai-agents-playbooks/) | A request, an alert, an unknown format, performance - prompts and calls |
| [MCP tool reference](https://tktail.dev/help/mcp-tools/) | Every tool an AI client sees, with its arguments and bounds |

**Windows and settings**

| Page | What it covers |
|---|---|
| [Linked windows](https://tktail.dev/help/windows/) | More windows of one TKTail for more monitors |
| [Settings](https://tktail.dev/help/settings/) | The Settings window: every page and option |
| [Windows integration](https://tktail.dev/help/windows-integration/) | Starting with Windows, the notification area, Explorer's right-click menu, shortcuts, the Jump List |
| [Where TKTail stores data](https://tktail.dev/help/data-and-privacy/) | The data folder (and choosing another), what is kept, privacy, cleanup, removing TKTail |

**Reference**

| Page | What it covers |
|---|---|
| [Command line](https://tktail.dev/help/command-line/) | Everyday `tktail` commands and scripting |
| [License](https://tktail.dev/help/license/) | The license badge, entering a license code, Free / Trial / Pro |
| [Testing with generated logs](https://tktail.dev/help/testing-with-generated-logs/) | TKTail Log Generator: live load, huge files, alerts and rotation |
| [Benchmarking TKTail on your PC](https://tktail.dev/help/benchmarking/) | The Benchmark Kit: repeat a release's published measurements and compare |
| [Troubleshooting](https://tktail.dev/help/troubleshooting/) | Common questions and what to check |

## The window at a glance

```
 [T] demo-app.log - C:\Logs - TKTail                    [hide to tray]  _  [ ]  X   (title bar)
 File  Edit  View  Layout  Tools  Help                                      (menu bar)
 [Open] [Folder] | [Explorer] [Inspector] [Panel] | LIVE | [Split] [Alert]   [Open Files v][Search all open files...]
+---- Explorer -----+---------- workspace (tabs, splits) ----------+-- Inspector --+
| Files, Windows    | demo-app.log                                  | file facts    |
| Event Logs        |  19967 2026-10-03 09:12:18.779 [ERROR] ...    | current record|
|-------------------|  ...                                          |               |
| filter            |                                     [LIVE]    |               |
| files             |                                               |               |
+-------------------+-----------------------------------------------+---------------+
| status bar: LIVE | line and position | size | encoding | format | line endings | alerts |
```

- The **toolbar** below the menu holds the most used actions: open a file or folder, show or
  hide the Explorer, the Inspector and the bottom panel (right-click the panel button
  for its views), **LIVE / PAUSED** of the current file (green / amber, click to switch),
  split the view (right-click for more) and add an alert. On its right is the **global
  search**: choose *Open Files*, *Folder* (the Explorer's folder) or *File Names*, type and
  press Enter - results appear in the bottom panel; Ctrl+Shift+F jumps there. (Ctrl+F searches
  only the current file.) Hide the toolbar with **View > Toolbar**;
  everything stays reachable from the menus and shortcuts. In a narrow window the less used
  buttons move into **...**.
- The **title bar** has, right before minimize, maximize and close, the **Hide to Notification Area** button (an
  arrow dropping into a tray): one click takes TKTail off the desktop while monitoring, LIVE tabs and alerts keep
  running; the icon in the notification area brings it back
  ([The notification area](https://tktail.dev/help/windows-integration/#the-notification-area-tray)).

- The **workspace** in the middle is always there. It holds tabs and can be split.
- The **Explorer** (left, Ctrl+B) and the **Inspector** (right, Ctrl+Shift+I) can be
  shown, hidden or collapsed to a narrow rail with the buttons in their headers.
- The **bottom panel** (Ctrl+J) below the documents holds tool views: search results, alerts, incidents,
  the record, output, a terminal.
- The **status bar** shows the state of the active tab; its segments are clickable.

## About this guide

This guide is TKTail's Help: **Help > TKTail Help** (or F1, which opens the page of what you are working in)
shows it in your web browser, from the `help` folder that comes with TKTail. **Help > Online Help** opens it at
[tktail.dev/help](https://tktail.dev/help/); TKTail's website is [tktail.dev](https://tktail.dev/) (**Help > TKTail
Website**). It describes the version it came
with and is updated together with the application. Where a feature is not available yet, the page says so.

---

Source: https://tktail.dev/help/getting-started/

# Getting started

From the download to your first log in a few minutes: what TKTail needs, how to run it, and the
ways to open a log.

## What you need

- Windows 10 version 1607 or later, Windows 11, or Windows Server 2016 or later (x64). The
  [terminal](https://tktail.dev/help/bottom-panel/#terminal) needs Windows 10 version 1809 or Windows Server 2019; a few
  other things differ on the older ones (a display scale change, the dark title bar) - see
  [System requirements](https://tktail.dev/help/system-requirements/). Earlier versions of TKTail need Windows 10 version
  1809 to start ([Troubleshooting](https://tktail.dev/help/troubleshooting/#entry-point-not-found-closepseudoconsole-when-starting-tktail)).
- No administrator rights. TKTail never asks for elevation during normal use.
- No installer and no runtime to install.

## Get TKTail running

1. [Download TKTail](https://tktail.dev/download/) - the package `TKTail-<version>.zip`. It holds
   `TKTail.exe`, this Help (the `help` folder) and `THIRD_PARTY_NOTICES.txt`. The download page shows
   its SHA-256 and how to check it.
2. Extract the ZIP into a folder of your choice, for example `C:\Tools\TKTail`. Keep the `help`
   folder beside `TKTail.exe`: Help and F1 open it from there.
3. Run `TKTail.exe`. Your settings and data are kept in `%LOCALAPPDATA%\TKTail`
   ([Where TKTail stores data](https://tktail.dev/help/data-and-privacy/)).
4. Open a log - see below.

## Opening files

| How | Notes |
|---|---|
| **File > Open...** (Ctrl+O) | Select one or more files. |
| **Drag and drop** | Drag a tab by its header to reorder it, move it to another pane, split it off near an edge - or out of the window ([Move tabs](https://tktail.dev/help/viewing-logs/#move-tabs)). Drop files onto a pane to open them there - near an edge for a new split. Files, event logs and metrics dragged from TKTail's own panels too: see [Drag sources into the workspace](https://tktail.dev/help/viewing-logs/#drag-sources-into-the-workspace). Dropping a folder shows it in the Explorer. |
| **Explorer panel** | Double-click a file, or press Enter. See [Explorer](https://tktail.dev/help/explorer/). Event logs open there too: see [Windows Event Log](https://tktail.dev/help/windows-event-log/). |
| **File > Recent Files** | The last opened files (and **Recent Folders**). |
| **Command line** | `TKTail.exe C:\Logs\app.log` or `tktail open *.log --paused`. See [Command line](https://tktail.dev/help/command-line/). |
| **Windows Explorer** | Optional: **Settings > Windows Integration** adds **Open with TKTail** to Explorer's right-click menu - for one file or many (per user; see [Windows integration](https://tktail.dev/help/windows-integration/)). |

A file opens at its **end** in LIVE mode: new lines appear as they are written. Use
`--paused` (or **View > Pause**) to stay at the top instead. Opening a file that is already
open activates its tab.

## One TKTail, many requests

TKTail runs as a single instance. Starting it again - from a shortcut, the command line,
Windows Explorer or a script - passes the request (open a file, show a folder, ...) to the
running window and exits. For more windows of the same investigation (another monitor), use
**File > New Linked Window** - see [Linked windows](https://tktail.dev/help/windows/). `--new-instance` starts a
separate, unrelated TKTail when you really need one.

## Closing the window

By default, closing the window asks one question - *What should TKTail do?* - and lists what is
running (for example *3 monitored files, 2 terminal sessions, 4 alert rules*):

- **Minimize to Tray** - the window hides; files stay monitored, alerts keep working,
  terminals and running jobs go on. The TKTail icon in the notification area opens the window
  again.
- **Exit TKTail** - monitoring and alerts stop, terminals (and the programs started in them)
  end, running jobs are cancelled, and TKTail closes.
- **Cancel** - nothing happens.

Tick **Remember my choice** to stop asking. **File > When Closing the Window** shows the
remembered choice and changes it at any time (*Ask Every Time*, *Minimize to Notification
Area*, *Exit TKTail*); it is the setting `general.closeAction`. Even with *Exit TKTail*
remembered, closing asks once when exiting would end running terminals or an export still
writing its file. The **Hide to Notification Area** button in the title bar, right before minimize (and **File >
Hide to Notification Area**) hides the window without asking. **File > Exit** (and **Exit TKTail** in the
tray menu) exits - it asks only when terminals or an export are still running, in one question, never a
series of them. Running searches are simply cancelled: exiting never asks about them.

Alerts watch only while TKTail runs, so exiting never stops them silently: with enabled alerts, closing
the window or **File > Exit** asks *Closing TKTail stops 4 active alerts* - **Keep Running in the
Notification Area** (the default: the window hides, the alerts go on), **Close and Stop Alerts**, or
**Cancel**. `tktail app exit` from a script exits without asking.

## Settings and Help

**Tools > Settings...** (Ctrl+,) holds every option - the theme and font, how files are followed,
alerts and their retention, AI access, starting with Windows, Explorer integration, where data is kept - see
[Settings](https://tktail.dev/help/settings/). **Help > TKTail Help** (F1) opens this guide in your browser, at the page of what you
are working in - from the `help` folder that comes with TKTail, so it works offline. **Help > Online Help** opens the
same guide at [tktail.dev/help](https://tktail.dev/help/), and **Help > TKTail Website** (or the *Website* link in
**Help > About TKTail**) opens the product's website, [tktail.dev](https://tktail.dev/).

## Where TKTail keeps its data

Settings, alerts, incidents and the rest are in `%LOCALAPPDATA%\TKTail` (per Windows user), in a folder you
choose, or - in **portable mode**, when a file named `TKTail.portable` is beside `TKTail.exe` - in a `data`
folder beside the EXE. TKTail contacts nothing over the network and has no telemetry. See
[Where TKTail stores data](https://tktail.dev/help/data-and-privacy/) for every file, privacy and cleanup.

## Starting with Windows

**Settings > Startup** starts TKTail when you sign in - hidden in the notification area, minimized or with the
window shown (per user, no administrator rights). See [Windows integration](https://tktail.dev/help/windows-integration/).

## Safe mode

If TKTail misbehaves after a change, start it with `--safe-mode`: it ignores the saved
workspace, monitored files, alert rules, custom formats and folder formats (`.tktail` files) for
that session.

## Next steps

- [Viewing logs](https://tktail.dev/help/viewing-logs/) - following, pausing, moving around and copying.
- [Rotating dated log files](https://tktail.dev/help/rotating-dated-logs/) - a new file every day or hour followed as one log.
- [Search](https://tktail.dev/help/search/) - in a file, in all open files, in folders, over time.
- [Explorer](https://tktail.dev/help/explorer/) - browsing log folders and the Windows Event Logs.
- [Windows Event Log](https://tktail.dev/help/windows-event-log/) - Application, System and other event logs, LIVE.

---

Source: https://tktail.dev/help/system-requirements/

# System requirements

Which Windows TKTail runs on, and which features need a newer Windows or look different on an older one.

## Windows

- **Windows 10 version 1607 or later, Windows 11, or Windows Server 2016 or later - x64.** There is no 32-bit
  version; Windows on ARM was not tested.
- On Windows Server, TKTail needs the **Desktop Experience** - it is a desktop program. Server Core was not tested.
- No administrator rights, no installer and no runtime to install.

Which Windows is which (`winver` shows yours):

| Windows | Version (build) |
|---|---|
| Windows Server 2016, Windows 10 Enterprise LTSB 2016 | 1607 (14393) |
| Windows Server 2019, Windows 10 Enterprise LTSC 2019 | 1809 (17763) |
| Windows Server 2022 | 21H2 (20348) |
| Windows Server 2025 | 24H2 (26100) |
| Windows 11 | 21H2 (22000) and later |

Earlier versions of TKTail need Windows 10 version 1809 or Windows Server 2019 to start
([Troubleshooting](https://tktail.dev/help/troubleshooting/#entry-point-not-found-closepseudoconsole-when-starting-tktail)).

## Features that need a newer Windows

Everything else works the same on every Windows above: huge files, LIVE, search, formats, the Inspector, Windows
Event Logs and saved `.evtx` files, Metrics, alerts and incidents, the Explorer, the System view, AI integration (MCP),
the command line, Windows integration and the Help.

| Feature | Needs | On an older Windows |
|---|---|---|
| [Integrated terminal](https://tktail.dev/help/bottom-panel/#terminal) | Windows 10 version 1809, Windows Server 2019 | The Terminal view says *The integrated terminal requires Windows 10 version 1809 or Windows Server 2019 or later.* and starts nothing. Its **+** menu still opens the profiles marked *(own window)* and **Run as Administrator**, each in a console window of its own. |
| A display scale change while TKTail runs - the window moved to a monitor with another scale, the scale changed, a Remote Desktop session at another scale | Windows 10 version 1703, Windows Server 2019 | Windows 10 version 1607 and Windows Server 2016: the log views, their tabs and the bottom panel's views keep the previous size until you restart TKTail, and the title bar keeps the main display's scale. TKTail always starts at the scale of its monitor. |
| Dark title bar in the [dark theme](https://tktail.dev/help/viewing-logs/#themes-and-fonts) | Windows 10 version 2004, Windows 11, Windows Server 2022 | The title bar stays light. |
| Dark scroll bars and tooltips of Windows' own controls in the dark theme | Windows 10 version 1809, Windows Server 2019 | The scroll bars of lists, trees and text boxes and the tooltips keep Windows' light look; everything TKTail draws itself - the log views, tabs, panels, menus - is dark. |
| Even pacing in [TKTail Log Generator](https://tktail.dev/help/testing-with-generated-logs/) (Windows' high-resolution timer) | Windows 10 version 1803, Windows Server 2019 | The generator uses the standard timer (steps of about 16 ms), so lines at a set rate arrive in coarser steps. |

## What looks different

- **Icons** on the toolbar and in the panels: Windows 11 draws them with its Segoe Fluent Icons font, Windows 10 and
  Windows Server with Segoe MDL2 Assets - the same symbols in a slightly different style.
- **The viewer font**, when **Settings > General > Viewer font** is empty: Cascadia Mono, which comes with Windows 11;
  otherwise Consolas (or Courier New).
- **Explorer's right-click menu**: Windows 11 shows TKTail's entries under **Show more options**; Windows 10 and
  Windows Server show them in the menu itself ([Windows integration](https://tktail.dev/help/windows-integration/#windows-explorer)).
- **Task Manager**: the tab that can switch off [starting with Windows](https://tktail.dev/help/windows-integration/#starting-with-windows)
  is **Startup apps** on Windows 11 and **Startup** on Windows 10; Windows Server's Task Manager has none.
- **The terminal's shell list** shows what is installed: the **WSL** entries only with the Windows Subsystem for
  Linux, **SSH...** only with Windows' OpenSSH client (`ssh.exe` in `C:\Windows\System32\OpenSSH`).

## Windows Server and virtual machines

- Without a usable graphics adapter - many virtual machines, some Remote Desktop sessions - TKTail draws with Windows'
  software renderer: everything works, drawing takes more processor time.
- The **Security** event log can be read by administrators and members of **Event Log Readers** only, on a server as
  on a PC ([Permissions](https://tktail.dev/help/windows-event-log/#permissions)).

## How this was checked

TKTail is tested on Windows 11. For Windows 10 and Windows Server, every Windows function TKTail imports is checked
against Windows 10 version 1607 / Windows Server 2016, and the differences above follow from what those versions do
not have. This version of TKTail has not been run on Windows 10 or Windows Server yet.

---

Source: https://tktail.dev/help/viewing-logs/

# Viewing logs

## LIVE and PAUSED

A file opens in **LIVE** mode: the view stays at the end and new lines appear as they are
written. The green **LIVE** marker in the bottom-right corner of the pane and the status bar
show the mode.

- **Scrolling up** (wheel, Up, PgUp, Home, dragging the scroll bar) switches to **PAUSED**
  so the text you are reading stops moving. A banner counts the lines that arrived since
  you paused.
- **F5** (View > Go Live) follows the end again; **Shift+F5** (View > Pause) pauses;
  the **Pause** key toggles.
- **Ctrl+Home** / **Ctrl+End** jump to the beginning / end of the file.

While a file grows, LIVE follows it smoothly - up to 60 frames a second, each showing the
newest lines. A fast writer (hundreds or thousands of lines per second) is still read, indexed
and checked by your alerts line by line; the view simply skips the states that came and went
between two frames. Pausing stops the movement at once; Go Live jumps straight to the current
end. The **Line** and **Inspector** panels follow a fast stream a few times a second and update
at once when you move the caret yourself. To save CPU on a laptop, lower the frame rate:
`view.liveFrameRate=30` in `settings.ini` (10-60; see [Getting started](https://tktail.dev/help/getting-started/)
for where it is), while TKTail is closed.

TKTail notices when a log is **rotated** (renamed, truncated or re-created by the writing
program). By default it follows the file *name*, like `tail -F`: when a new file appears
under the same name, it continues with the new file. The rotation is recorded in the alert
history.

Logs whose **name carries the date** (`app_2026-10-14.log`, then `app_2026-10-15.log`) are one log
for TKTail too: when the next file appears it becomes LIVE beside the current tab, and the status
bar says `SERIES → app_2026-10-15.log` - see [Rotating dated log files](https://tktail.dev/help/rotating-dated-logs/).

## Large files and network shares

A file of any size opens at once, and a log on a network share is followed with checks you can tune - see
[Huge files and network shares](https://tktail.dev/help/large-and-network-files/).

## Moving around

| Action | How |
|---|---|
| Move the caret | Click, or Left/Right (Ctrl: by word), Up/Down, PgUp/PgDn |
| Start / end of the line | Home / End (with Word Wrap: of the row you see) |
| Beginning / end of the file | Ctrl+Home / Ctrl+End |
| Select with the keyboard | Hold Shift with any of the keys above |
| Scroll without moving the caret | Wheel, Ctrl+Up / Ctrl+Down, the scroll bars |
| Scroll sideways | Shift+wheel, horizontal wheel |
| Go to a line or byte offset | **Ctrl+G** (also from the Inspector's Line / Byte offset values); sizes such as `64KB` or `8GB` work for offsets; a number outside the file is explained in the dialog. From the command line: `tktail open app.log --line 150000`, `--offset 8GB` |
| Next / previous record | **Alt+Down** / **Alt+Up** - by log entry, not by line: a stack trace or a payload is skipped as one ([below](https://tktail.dev/help/viewing-logs/#records-and-time)) |
| Go to a date and time | **Ctrl+Shift+G** (Edit > Go To Time) - the record whose time is nearest ([below](https://tktail.dev/help/viewing-logs/#records-and-time)) |
| Zoom | Ctrl+wheel, Ctrl+Plus / Ctrl+Minus, Ctrl+0 resets |

The file viewer has a caret like an editor, but it never changes the file. The status bar
shows its position as **Ln 1,234, Col 56**: the line number and the character in that line
(characters, not bytes - `ż` or `日` count as one). Hover it for the exact byte offset; click
it for Go To, right-click it to copy the line number or the byte offset, copy the line or show
it in full. On a gigantic line the column may show `?` for a moment while TKTail counts in the
background - the window never waits for it. Very long lines are shown in rows of 16 KB, and the
caret moves through them row by row.

The line with the caret has a faint background; **View > Highlight Current Line** turns it
off.

**View > Word Wrap** (**Alt+Z**, also on the right-click menu) wraps long lines to the window
width - at spaces and punctuation where possible. It is off by default, because columns, JSON
and protocol messages are easier to scan one line per row; the choice applies to the active
view and becomes the default for new ones. Wrapping changes only the display: the line number
appears on the first row of a line, the status bar keeps showing the line and the character
column in that line, and selecting, copying (also **Copy Full Selected Lines**), Find, alerts
and Go To work on the real lines. Wrap works for any text - also lines without a single space
(Base64, long number lists, URLs), Chinese / Japanese text and emoji: every character stays
inside the window. Long lines stay one line: a record of tens or hundreds of kilobytes (a JSON
payload, a trading message) wraps as one continuous paragraph, and with wrap off it is one row
you scroll sideways. Only lines longer than 1 MB continue on a new row every megabyte (marked
with the continuation arrow). The caret, clicks and selections stay exactly on the characters,
also after Chinese / Japanese text and emoji. With Word Wrap on, Up / Down move by the rows you see and
Home / End go to the start / end of the row; there is no horizontal scrolling (the previous
position comes back when you turn wrapping off).

While a file is LIVE, a caret at the end of the file stays at the end as new lines arrive.
Moving the caret away with the keyboard pauses the view (like scrolling up does); clicking
into the text does not. Search results, alerts and Go To put the caret on the target and
scroll sideways when the target is far to the right.

The scroll bar maps to the position **in bytes**, so it works the same for a 1 KB and a
100 GB file. Line numbers in the gutter are exact; for very large files they appear once the
background line index has reached that part of the file (**View > Build Full Line Index**
builds it completely). **View > Line Numbers** (Ctrl+Shift+L) and **View > Observation Time**
(Ctrl+Shift+T, the time TKTail saw each line arrive) toggle the gutter columns.

## Records and time

**Lines describe storage; records describe meaning.** A log entry - a *record* - is often one
line, but an ERROR with its stack trace, a JSON payload written over several lines or a block
of a Qlik trace are one record of several source lines. TKTail frames records the way the
file's format defines them (the same framing as the RECORD view, the Inspector and Search);
plain text has one record per line.

**Previous / Next Record** - **Alt+Up** / **Alt+Down** (View > Previous Record / Next Record, also
on the right-click menu) move the caret to the start of the previous / next record. From a
continuation line - a frame of a stack trace - Next goes to the next entry and Previous to the
entry before this one (not its first line). At the first record Previous does nothing, at the
last one Next does nothing (nothing wraps around); in a LIVE file, a new entry becomes the next
one as it arrives. Like any keyboard move, the selection goes, a LIVE view pauses when the caret
leaves the end, and the status bar, the RECORD view and the Inspector follow. In an event tab
the keys move to the previous / next event.

**Go To Time** - **Ctrl+Shift+G** (Edit > Go To Time; or Ctrl+G and *Date and time*; or click the
time range in the status bar) goes to the record whose time is **nearest** the date and time
you type - not the first one at or after it: in a file with `04:49:08.000` and
`04:49:11.1064`, *04:49:10* goes to `04:49:11.1064` (1.1 s away, the other is 2 s). Two records
equally near: the earlier time. Type `2026-10-06 04:49:10` - fractions as precise as you like
(`.125`, `.1064`, `.1234567`), they need not match the file's - or an ISO time with a zone
(`2026-10-06T02:49:10Z`). The dialog shows the file's time range when it is known.

- The time is the **record's own time**, as its format reads it (an application log's
  timestamp, an IIS log's date and time, a JSON field with the timestamp role, a custom
  format's timestamp) - the same times Search's time ranges use. A multiline record is found by
  its first line's time and the caret goes to that line; the RECORD view shows the whole entry.
  Timestamp-looking text inside a stack trace or a message is never used.
- Times are compared as the file has them: times written without a zone are your wall-clock
  times, compared as typed; UTC times (IIS, ISO with `Z`) are compared with the moment you typed
  in this computer's time zone. A time of day without a date (a Qlik trace) is never given one:
  Go To Time needs a date and says so. A file without record times (plain text) says so too -
  nothing is searched as text.
- The order of the file does not matter: records whose times jump back and forth are compared
  by time, not by position.
- The status bar then shows the result: `nearest record 2026-10-06 04:49:11.1064 (+1.1064 s from
  2026-10-06 04:49:10.000)`.
- The first Go To Time in a large file reads its record times (in the background - the window
  stays usable; the status bar shows the progress); after that the answer is immediate, and a
  growing file only adds what is new.

**Show Metrics Around This Time** (right-click a record; Trial / Pro) opens a Metrics View
beside the log, paused at the record's time - what the CPU, memory, disk or a process did then.
See [Metrics](https://tktail.dev/help/metrics/#from-a-log-to-metrics).

**The file's time range** - the smallest and the largest record time in the file, not the time
of its first and last line (a file can be out of order). The status bar shows it as
`TS 02:11:17.552 → 07:42:08.6266` (with the dates when they differ; a narrow window shortens it
or leaves it out - hover it for the full values), the Inspector's **Time range** section shows
From, To, the span and how many records have a time. Until every record has been read it is
never shown as the whole file's range: *TS reading 34 %* while the times are read, *TS partial
04:49 → 06:12* for a part, *TS not read* for a file larger than 256 MB whose times are read only
when you ask (click it, View > Read the File's Times, or Go To Time). Files up to 256 MB are read
in the background when you look at them; opening a file never waits for it. A LIVE file's
range grows with it - also backwards, when an older time is appended. A file without record
times shows no range (the Inspector says *Not available*). When the file is replaced, rotated,
truncated or read as another format, its times are read again - nothing of the old file is
used.

## Selecting and copying

- Drag to select, Shift+click or Shift with the caret keys to extend, double-click selects a
  word. Esc clears the selection and the search highlight.
- **Edit > Copy** (Ctrl+C) copies exactly what is selected; **Copy with Line Numbers**
  (Ctrl+Shift+C), **Copy Visible Lines**, **Copy File Path**, **Select All** (Ctrl+A).
- Whole lines, without selecting them first (right-click in the text, or the Edit menu):
  - **Copy Current Line** (**Copy Full Line** when part of one line is selected) copies the
    complete line the caret is on - also the part that is scrolled off to the right.
  - **Copy Full Selected Lines** copies every line the selection touches, complete, even if
    the selection starts or ends in the middle of a line; also **with Line Numbers**.
  - **Copy Line Start to Caret** and **Copy Caret to Line End** copy one part of the line.
  - **Select Line** and **Expand Selection to Full Lines** change the selection itself, so a
    normal Copy then copies whole lines.
  - For structured files (FIX, JSON lines, CSV, IIS, syslog, ...) and logs whose records span
    several lines (an error with its stack trace, a request with a JSON payload): **Copy
    Current Record** copies the complete record exactly as in the file - whichever of its lines
    the caret is on - and **Export Current Record...** saves it to a file.
  - Copied lines are separated by Windows line breaks; no line break is added after the last
    line. Line numbers are only included when you choose a *with Line Numbers* command.
- Copying more than 16 MB asks first: **Copy anyway**, **Export instead...** (the Export
  dialog with exactly that text chosen - see *Exporting* below) or **Cancel**. Above 128 MB
  only Export is offered: the clipboard cannot hold that much reasonably.
- Lines longer than 16 MB in one direction from the caret are too long for the line
  commands; select the part you need, or export it.

## Exporting

**File > Export...** (Ctrl+Shift+S) saves part of the file - or all of it - to a new file. The
Save dialog has two choices besides the name:

- **Export:** what to save - the **Selection**, the **Current line**, the **Current record**
  (logs whose records span several lines), the **Whole file**, or the **Lines matching** the
  current find (with Ctrl+F) - each with its size.
- **Save as type:** **Original bytes** (exactly as in the file), **Text** (decoded and saved as
  UTF-8 - see `export.encoding` / `export.lineEndings` in the settings), and for structured
  formats **CSV**, **TSV** or **JSON Lines** with one row or object per record.

Exports run in the background (the Jobs view shows the progress and can cancel them); the
file appears under its name only when it is complete. A **Lines matching** export whose regular
expression is too complex for some line fails instead of saving a file with that line left out. A growing log is exported up to where it
was when you started. **Export Current Record...** (right-click in the text) and the **Export**
button of the RECORD view open the same dialog with the current record or line chosen.

## Find

**Ctrl+F** opens the find bar below the tabs of the pane you work in and searches the current file; **F3** /
**Shift+F3** go to the next / previous match. Everything about it - and about searching several files, folders,
event logs and time sequences - is on [Search](https://tktail.dev/help/search/).

## Encodings

TKTail detects UTF-8, UTF-16 LE/BE (with or without BOM) and falls back to the system code
page. **View > Encoding** overrides the detection for the active file: UTF-8, UTF-16 LE,
UTF-16 BE, ANSI, OEM, Windows-1250, Windows-1252. The status bar shows the encoding in use.

## Record formats (View As)

Many logs are records rather than plain lines. TKTail detects the format from small samples of
the start and the end of the file (never the whole file) and colours the important parts
(timestamp, level, fields); the [Inspector](https://tktail.dev/help/inspector/) shows the fields of the current
record. Detection looks at the **whole record**: a log line such as
`[2026-10-04T21:33:35.2593298Z] [TRACE] [MarketClient] [RESTSYSTEM] MessageReceived ... {"MESSAGE":"..."}`
is an application log (time, level, component, context, message) even though its message holds
JSON - a file is JSON only when its records really are JSON. The file name's extension is only
a hint: a structured log named `.txt` is still detected. The Inspector's **Format** row says how
sure the detection is (for example *detected, high confidence*), with the evidence and the other
candidates it ruled out below it. A detected format never changes while the file grows;
**View > View As > Auto (Effective Configuration)** decides again.

**Delimited files.** Comma-separated (CSV), semicolon-separated (CSV, as Qlik and many European
exports write them - `12500,50` stays one value), TAB-separated (TSV) and pipe-separated files are
recognized from their content: TKTail splits a sample of the file with each separator - text inside
quotes counts as one value - and picks the one that gives the same number of columns on every line.
A `.csv` file can be either comma or semicolon. When a file fits two separators equally, the Inspector
shows both candidates as *ambiguous*; choose with **View > View As > Delimited > CSV (comma)**,
**CSV (semicolon)**, **TSV (tab)** or **Delimited (pipe)** - your choice stays. The first line names
the columns when none of its values is a number; a file with such a line opens as a table even when
its rows start with a time and a level (a column named *time* or *level* still works as the record's
time and severity). A quoted value that contains a line break is not
joined into one record (each line is shown as its own record).

**View > View As** chooses a format by hand: plain text, JSON / JSON Lines, CSV (comma or semicolon), TSV, pipe-delimited,
logfmt, INI and properties, syslog (RFC 3164 and 5424), IIS W3C Extended Log, Apache, Nginx, Docker and
Kubernetes (CRI) logs, Serilog CLEF, PostgreSQL logs, CEF, LEEF, MySQL logs, application logs
with stack traces, FIX, HL7, X12, EDIFACT and more. Formats marked *(partial)* work for
common files but not for every variant.
`tktail formats list` prints the full list and `tktail formats detect <file>` shows what the
content detection sees in a file, how confident it is and why (the evidence and the rejected
candidates).

**Favorite formats.** The formats you choose most can be favorites: **View > View As > Add &lt;format&gt;
to Favorites** marks the current file's format (built-in or your own), and the Custom Format Studio's
**Use For > Favorite Format** marks the profile you are editing. Favorites are listed first - with a
star - in View As, the RECORD view's Format menu and the format lists of **Set Format for This File /
Folder...** and **Edit Local Configuration...**, so one click sets them; each is also still listed in
its usual place (the star marks the shortcut). **View As > Manage Favorite Formats...** puts them in
your order (Move Up / Move Down), removes one, adds any other format, and opens one of your own
profiles in the Custom Format Studio (**Edit...**). At most 16; a favorite custom profile that is not
installed any more stays in the list, disabled, until it is back.

**The Format button.** The RECORD view's header always says how TKTail reads the current file:
`Format: Auto (FIX)` when the configuration or the detection decided (its tooltip says which,
and names the `.tktail` that did), `Format: FIX` when you chose it for this session. A click opens
the same View As menu - choosing there is the same session choice, and **Auto (Effective
Configuration)** goes back to the configuration and detection. Nothing is written to a `.tktail`
until you pick one of the **Set Format for This File / Folder...** items. Event tabs show
`Format: Windows Event Log`: Windows defines their structure, there is nothing to choose.

**Which format a file gets.** A format you choose with View As wins for this session. Otherwise
a `.tktail` file in the log's folder (or a folder above it) decides - for example "the logs in
this folder are Qlik traces" - then a custom profile that names such files, then detection.
**View > View As > Set Format for This File / Folder...** writes that `.tktail` for you; see
[Folder formats](https://tktail.dev/help/local-configuration/). The Inspector's *Resolution* row says which step
decided, and **View As > Explain Format Resolution...** shows every step.

**If TKTail picked the wrong format:**
1. Look at the Inspector's **Format** and **Resolution** rows: a *configured* format comes from
   a `.tktail` (the *Configuration* row says which); a *detected* one shows how sure the
   detection was, the **Evidence**, and the **Other candidates** with why they were ruled out.
   If the Format tooltip says *Content detector disagrees* (the Inspector: a *Content detector*
   row marked *differs*), a `.tktail` or a custom profile's detection rules (*Profile
   association*) chose the format although the content looks like another one: change that rule
   or the profile's *Detection* in the [Custom Format Studio](https://tktail.dev/help/custom-formats/).
2. **View > View As** chooses the right format by hand for this session; it always wins.
   **Set Format for This File / Folder...** keeps the choice for next time.
3. **View > View As > Auto (Effective Configuration)** decides again, for example after the file
   was replaced.
4. `tktail formats resolve <file>` explains the choice on the command line; `tktail formats
   detect <file>` shows the content evidence.

Built-in formats in short:
- **Application logs have fields, not fixed columns.** log4net, log4j, NLog and similar
  libraries let each application choose the order of the time, the level, the logger and the
  thread; TKTail recognises the common orders and gives every one the same fields
  (`timestamp`, `level`, `component`, `thread`, `message`) - in RECORD, the Inspector, Search and
  field conditions alike:

  ```
  2026-10-03 22:31:01.123 [ERROR] RestApi.Service.Orders - message
  [2026-10-03 22:31:01.123] [ERROR] [Orders] [req-42] message
  DEBUG - 2026-10-06 15:55:23,484 [RCloud.Import.Service.DomainImportService] - message
  2026-08-15 16:30:10,175 [RCloud.Import.Service.SftpFailoverConnector] - ERROR - message
  2026-10-06 15:55:23,484 INFO  [main] com.example.Orders - message
  ```

  The order is learned from the first lines of the file; a level or a date inside the message
  stays message text. A layout TKTail does not recognise is a job for a
  [custom format](https://tktail.dev/help/custom-formats/).
- **One line is not always one log entry.** In an application log a record starts at a line
  with a time and a level in the file's layout; the lines after it - an exception, stack frames, a
  JSON payload, text - belong to it until the next such line. With the caret on any of them, the Inspector and
  the RECORD view show the whole entry, and its message includes those lines. Search and alerts
  still work line by line: a hit on a stack frame takes you to that line.
- A JSON object inside a message does not make the file "JSON": it stays part of the message.
- **IIS logs** (`u_ex261003.log`, *View As > Logs > IIS W3C Extended Log*) are read by their own
  `#Fields:` line - no custom format needed. The request
  `2026-10-03 20:37:46 203.0.113.10 GET /api/customers - 443 - 198.51.100.46 curl/8.4.0 - 500 0 0 705`
  becomes:

  | Field | Value |
  |---|---|
  | `timestamp` | 2026-10-03 20:37:46 (UTC - IIS writes W3C times in UTC) |
  | `cs-method` | GET |
  | `cs-uri-stem` | /api/customers |
  | `sc-status` | 500 |
  | `c-ip` | 198.51.100.46 |
  | `time-taken` | 705 |

  and RECORD's Summary reads *500 Internal Server Error - GET /api/customers* with the time,
  duration, client and server. `-` means "no value". Find with the field condition button
  searches the fields directly: `sc-status >= 500`, `cs-method = POST`.
- The details of every format are in FORMATS.md.

### Qlik Script Trace

TKTail reads the trace of a Qlik script reload (**Qlik Script Trace**). In it, a line holding only
a time - `09:49:02` - starts a *time block*, and the lines after it belong to that block until the
next time line. With the caret on any line of a block, the Inspector and the RECORD view show the
whole block:
- **Summary**: `Qlik · 09:49:02`, the number of entries in the block and, when the block holds
  exactly one load, the target table (`Orders << ...`), the source and the rows fetched
  (`Lines fetched: 23 916` is read as 23916). MESSAGE is the block exactly as written.
- A script error such as `Found an END IF statement, but there is no open IF statement.: ENDIF`
  makes its block `ERROR · Qlik Script`, coloured as an error. Nothing else gets a severity: the
  trace has none.
- The trace has no date, so TKTail shows the time only.
- Lines before the first time line form a block of their own; the last block grows while the
  reload writes.

Search, alerts and Copy work as everywhere: search lands on the line, the Inspector shows its
block, *Copy Current Record* copies the time line and the block. Detection needs the time lines
together with Qlik's own lines (loads and `Lines fetched`). Only the script reload trace is
supported - other Qlik logs are not "Qlik Script Trace". Details:
FORMATS.md.

### Your own formats

When your log format is not built in, describe it in a **custom format profile** - with the
**Custom Format Studio** (**Tools > Custom Format Studio...**) and its live preview, or as a small
JSON file. **View > View As > Create Format for This Log...** opens the Studio on a new profile with
up to 50 records of the current log (from the record you are on) as its sample, so the preview shows
at once how the draft reads them. TKTail then detects, parses, colours, searches and alerts on it like a built-in
format. A profile is data only - patterns and field names; nothing in it is ever run. The full
guide, with a walkthrough: [Your own log formats](https://tktail.dev/help/custom-formats/).

## Tabs and splits

- Each opened file gets a tab; opening it again activates the tab.
- **Layout > Split Right** (Ctrl+\\) and **Split Down** (Ctrl+Shift+\\) show the active file in
  a second pane - for example the beginning and the end of the same log. **Close Split**
  merges the panes again.
- **Ctrl+Tab** / **Ctrl+Shift+Tab** (or Ctrl+PgDn / Ctrl+PgUp) switch tabs; **Ctrl+W** closes
  the active tab; middle-click on a tab closes it, and so does its **x** (shown on the active
  tab and the one under the mouse).
- What a tab shows: the file name (with its folder when two open files have the same name), a
  **green dot** when the tab is LIVE or an **amber dot** when it is PAUSED; a **blue ring**
  around the dot means the file is also **monitored** in the background (alerts keep working
  when the tab is closed); a small **red dot** after the name means unread alerts for that
  file. Hover a tab for its full path, size, encoding, format and state.
- Right-click a tab for Close, Close Others, Close Tabs to the Right, Split Right / Below,
  the **Move** commands (next section), Pause or Go Live, Monitor in Background, Add Alert, Reveal
  in Explorer, Open Containing Folder and Copy File Name / Full Path.
- With many files, use the **<** **>** buttons or the mouse wheel over the tabs, or the list
  button at the right end to pick any open file.
- In a split, the pane you work in is marked by the blue line on its active tab.

- Drop a file on a pane to open it there - see [Drag sources into the
  workspace](https://tktail.dev/help/viewing-logs/#drag-sources-into-the-workspace).

## Move tabs

A tab is not tied to the pane it was opened in. **Drag a tab by its header** - a log, an event log,
a Metrics View - and drop it:

| Drop it | What happens |
|---|---|
| between two tabs of a pane (also its own) | it moves there - a marker shows the place |
| in the **middle** of another pane | it joins that pane, after its tabs |
| near an **edge** of a pane (its outer quarter) | a new split on that side, with only this tab: `this tab \| what was there` |
| outside the TKTail window | a new [linked window](https://tktail.dev/help/windows/#move-a-tab-to-another-window) with only this tab (Trial and Pro) |
| on another TKTail window | it moves to that window - the same middle / edges there |

**The middle joins, the edges split.** While you drag, the pane under the mouse shows its zones -
the frame around the middle is the split zones - the place a drop takes is filled in, and the status
bar says what the drop will do. A pane that is left with no tab closes, so dragging the last tab of
a split into the other pane merges the two panes again. **Esc** cancels: nothing moves.

A moved tab is the same tab: the file stays open, its position, LIVE / PAUSED, word wrap, selection
and find text stay as they were, an event log keeps reading, a Metrics View keeps its history -
nothing is opened again. The tab you moved becomes the active one.

The same moves without dragging (right-click a tab, or **Layout** for the active tab):

- **Move to New Split** > *Left* / *Right* / *Top* / *Bottom* - the tab alone beside its pane (only
  when other tabs stay in the pane);
- **Move to Pane** > another pane (named by the tab it shows);
- **Move to New Window** and **Move to Window** > a window - see [Linked windows](https://tktail.dev/help/windows/#move-a-tab-to-another-window).

Moving tabs within a window works with every license.

## When TKTail starts again

TKTail reopens your workspace as you left it: the same tabs in the same panes and splits, the same
tab in front, and in each tab what you were looking at - a paused log at the same place (selection,
word wrap and find text too), a LIVE one following the end again, an event log with its history and
filter (paused ones with the selected event selected again once read), a Metrics View with its
metrics, colours, names and lanes (still marked changed `*` if it differed from its Metric Set). The
window shows first; the tabs open a moment later, without reading whole files.

- A file that changed since (rotated, rewritten) opens at the record nearest the time you were at,
  not at a byte position that means something else now; the status bar says so.
- A file that is gone, an event log you can no longer read, or a Metrics View your license does not
  include is skipped - the rest opens, the status bar counts what is missing and **Problems** lists
  the files (with *Open* to try again).
- A file on a network share that does not answer at once opens a moment later, when the share
  answers - TKTail does not wait for it. If the share cannot be reached, **Problems** says so (with
  *Open* to try again). Opening a file on such a share from the Open dialog or a dropped file works
  the same way. Until the share has answered, the saved workspace keeps the tab.
- Not reopened: running searches, exports and terminals (the SEARCH RESULTS list shows the last
  searches as *not run*; run them again when you need them) and linked windows.
- Metrics Views start their graphs again: samples are not saved.
- **File > Reopen Workspace at Start** turns it off (TKTail then starts empty and saves nothing). The
  workspace is saved in `workspace.json` in the TKTail data folder - a few seconds after changes and
  when you exit; after a crash the state of about a minute before is reopened. If the window was on a
  monitor that is no longer there, it opens on the nearest one.

## Drag sources into the workspace

Anything TKTail can investigate can be dragged to where you want to investigate it - the same
gesture for every kind of source:

| Drag | from | Opens |
|---|---|---|
| one or several files (Ctrl / Shift selection) | the [Explorer](https://tktail.dev/help/explorer/)'s file list, or Windows Explorer | a log tab each (a saved `.evtx`: its events) |
| an event log (*System*, *Application*, ...) | the Explorer's **Windows Event Logs** | its event tab |
| one or several metrics | the [METRICS panel](https://tktail.dev/help/metrics/#the-metrics-panel) | a Metrics View - or into one (below) |
| a folder | the Explorer's tree, or Windows Explorer | the folder in the Explorer (never every file in it) |

Where you drop decides where it opens - a translucent highlight shows it, and the status bar says
what the drop will do:

- **the middle of a pane, or its tabs**: new tabs in that pane;
- **near an edge of a pane** (its outer quarter): a new split on that side - the dragged sources
  side by side with what you were looking at (`current view | payment.log`);
- **metrics onto a Metrics View**: they join that view (below).

Several files open as tabs of the same pane, in the order they were selected; at most 64 at a time
(the rest are named in the status bar). A source that is open already is shown, not opened twice -
as when you open it from a menu - and a source that cannot be opened (a file that is gone, an event
log you may not read) is reported the usual way while the others open. Nothing is read while you
drag: the files open when you drop them. Every drag has a menu equivalent (Open, Split Right /
Below, *Open in New Split*, *Add to Metrics View*). Drop sources into the window you dragged them
from; to take an open tab to another window, [move the tab](https://tktail.dev/help/viewing-logs/#move-tabs).

## Themes and fonts

**View > Theme**: Follow Windows, Light or Dark. The change applies immediately to the whole
window - menus, toolbar, tabs, panels, scroll bars - and *Follow Windows* also follows a
change of the Windows setting while TKTail runs. Only the **Windows Context Menu** of a file
in the [Explorer](https://tktail.dev/help/explorer/) keeps the look Windows gives it. On an older Windows the title bar
(before Windows 10 version 2004 / Windows Server 2022) and Windows' own scroll bars and tooltips
(before Windows 10 version 1809 / Windows Server 2019) stay light in the dark theme
([System requirements](https://tktail.dev/help/system-requirements/#features-that-need-a-newer-windows)).
**View > Bigger Font / Smaller Font / Reset Font Size** change the text size (also
Ctrl+wheel).

## Status bar

From left to right: messages, *Monitoring paused* (only when all monitoring is paused),
LIVE/PAUSED (with new lines while paused), line and position (%), file size and growth,
encoding, record format, line endings (CRLF / LF / Mixed), the file's time range (`TS ...`,
[above](https://tktail.dev/help/viewing-logs/#records-and-time)), line index state and alerts.

While a file grows, the size shows how much data and how many lines arrive, for example
`58.3 MB  +7.40 KB/s · +128 lines/s`. *Lines/s* counts complete new lines of the file (a line
that is still being written counts once it ends; word wrap makes no difference), so a log of
huge records can show `+1.5 MB/s · 2 lines/s`. It keeps measuring while the view is PAUSED and
disappears about two seconds after the writer stops. In a narrow window it shortens to
`+7.40 KB/s · 128 ln/s`; hover it for the full numbers.

The last segment shows the license in short: `FREE · Non-commercial`, `TRIAL · 18 days left`,
or `PRO PERSONAL` / `PRO BUSINESS` with the owner's name - the badge in the toolbar shows the
same, larger (see [License](https://tktail.dev/help/license/)). Hover it for the details, click it for the license
details, right-click it to enter a license code, copy the license information or hide the
owner's name (handy for screenshots).
Hover a segment for a short explanation. Segments with a hand cursor are buttons - they run
the same commands as the menus:

| Segment | Click to |
|---|---|
| Monitoring paused | Resume all monitoring |
| LIVE / PAUSED | Pause / Go Live |
| Ln / Offset / Sel | Go to a line or offset (Ctrl+G) |
| Size | Show the Inspector |
| Encoding | Choose an encoding (the View > Encoding menu) |
| Format | View as another record format (the View > View As menu) |
| TS (time range) | Go To Time; *partial* / *not read*: read the file's times |
| Index: tail | Build the full line index |
| Alerts | Add Alert, Mark All Alerts as Read, Pause All Monitoring |

---

Source: https://tktail.dev/help/search/

# Search

TKTail searches without loading files into memory and without freezing the window - also a file of many
gigabytes. Which search to use:

| You want | Use |
|---|---|
| The next place in this file | **Find** - Ctrl+F (below) |
| Every match in all open files and event logs | **Find in All Open Files** - Ctrl+Shift+F, or the search box on the right of the toolbar |
| Text, a field condition, a time range - in chosen files, folders or event logs | **Advanced Search** - Ctrl+Alt+F ([Advanced Search](https://tktail.dev/help/bottom-panel/#advanced-search)) |
| Only among the results of a search | **Search Within These Results** ([Search Results](https://tktail.dev/help/bottom-panel/#search-results)) |
| One thing, then another within a time window ("a WARN, then an ERROR within 30 s") | a **sequence** in Advanced Search ([Sequences](https://tktail.dev/help/bottom-panel/#sequences-one-thing-then-another-in-time)) |
| Files by name or content in a folder - without opening them | the Explorer's **Search Files...** / **Search Contents...** ([Searching folders](https://tktail.dev/help/explorer/#searching-folders)) |
| Events in an event log | Find in an event tab ([Finding events](https://tktail.dev/help/windows-event-log/#finding-events)) |
| The same question again later | a **Saved Search** ([Save the question, save the answer](https://tktail.dev/help/bottom-panel/#save-the-question-save-the-answer)) |
| The results kept across a restart, or kept before the log rotates | **Pin Search**, then **Save as Evidence** ([Rotating logs: pin, then save](https://tktail.dev/help/saving-evidence/#rotating-logs-pin-then-save)) |
| An AI assistant to search for you - and to summarize what it finds (the top 10 client IPs, requests per minute, average times) | [AI assistance](https://tktail.dev/help/ai-assistance/#search-and-summaries) - its searches show in Search Results too |

Every search except Find keeps its results as a **search session** in the bottom panel's
[Search Results](https://tktail.dev/help/bottom-panel/#search-results): you can open each result, refine, export or save it, and
run it again later. A search says exactly what it searched and whether everything was searched
(*Completed*, *Incomplete* with the reason, *Cancelled*).

## Find in a file

**Ctrl+F** opens the find bar directly below the tabs of the pane you are working in; it
searches **only the current file** (the toolbar's search box searches open files or folders).

- Type and press **Enter** (next) or **Shift+Enter** (previous), or use the up / down arrows;
  **F3** / **Shift+F3** work from the pane too. **Esc** or **x** closes the bar - the search
  stays with the file.
- Options (the small buttons): **Aa** match case, **.\*** regular expression, the funnel for a
  field condition such as `level = ERROR` in structured records, and the circular arrows for
  wrapping around at the end of the file.
- Next to the query the bar shows where you are, for example **3 / 864** (the third of 864
  matches). The total is counted in the background after the first match is found
  ("counting 42%" meanwhile), so even huge files never freeze. With more than 100,000 matches
  the bar shows only the total. **No matches** means the file does not contain it.
- Every tab keeps its own search: switching tabs shows that tab's query and result; a tab
  without a search keeps what you typed, so Enter repeats it there. In a split, the bar moves
  to the pane you click into.
- The search runs in the background in slices, so it never freezes the window, even on huge
  files; the result is highlighted and scrolled into view (the view pauses).
- Previous searches are kept in the find history.

## Regular expressions

With **.\*** on, the query is a regular expression - the same rules everywhere TKTail searches:
the find bar, Find in All Open Files, Advanced Search, event tabs, alert rules and the export
filter.

- **Any language.** Letters, digits and case work for every script: with **Aa** off,
  `zamówienie` finds `ZAMÓWIENIE` and `Zamówienie`; `.` is one whole character, an emoji too;
  `\d`, `\w` and `\s` include non-Latin digits, letters and spaces (use `[0-9]` for ASCII digits
  only).
- **One line at a time.** A match never runs across lines; `^` and `$` are the start and the end
  of the line. In a log whose entries span several lines (a stack trace), the line that matches
  is found and the Inspector / RECORD show the whole entry.
- **Useful additions:** look behind `(?<=\$)\d+` (a number after `$`), named groups
  `(?<year>\d{4})`, Unicode classes `\p{L}` (any letter), `(?i)` for case-insensitive, `\x{F3}`
  for a character by its code. Older patterns with `\u` and four hex digits (`\u00F3`) still work.
- **Patterns that would run away** (`(a+)+$` on a long line) stop at once at that line. TKTail
  has two safety layers: each line has a fixed limit, and a whole search has a breaker. In the
  find bar, Find Next ends with *Regex complexity limit exceeded on a line - simplify the
  pattern*, and a count that stopped there says so - *1 / 2 · incomplete* (point at it for the
  reason). A search over sources (Find in All Open Files, Advanced Search) skips such a line, keeps
  going and says *Incomplete - 1 line skipped*; a pattern that keeps hitting the limit is stopped -
  *This regular expression is too expensive for the data searched - simplify the pattern* - and
  what it found stays. That is not a syntax error: the same pattern may be fine on other data.
  Exporting the lines matching such a pattern fails rather than leave lines out. A mistake in the
  pattern
  says where it is: *Invalid regular expression at position 4: missing closing parenthesis*.
  When the find bar cuts a message short, point at it to read all of it.
- Searching for text that is not a regular expression is faster with **.\*** off.

## Recipes

**Search across several files** - open them (or drop them into TKTail), press **Ctrl+Shift+F**, type the
text and press Enter. The results list each match with its file, line and time; double-click one to go
there.

**Errors of one request across logs** - **Advanced Search** (Ctrl+Alt+F): add the files, a field condition
`requestId = ABC123` (or the text), a time range if you know it; **Search**.

**What happened right before an error** - a **sequence**: step 1 `WARN`, step 2 `ERROR` within 30 seconds after
it - see [Sequences](https://tktail.dev/help/bottom-panel/#sequences-one-thing-then-another-in-time).

**A folder of old logs** - in the Explorer, right-click the folder > **Search Contents...** - the files are read
without being opened as tabs.

## Search reference

Everything TKTail can search, in one table - the pages linked hold the details.

| | What TKTail offers |
|---|---|
| **Where** | the current file (Find); all open files and event logs (Find in All Open Files); chosen sources - up to 16 open files, event logs or folders, with subfolders and `;`-separated Include / Exclude masks (Advanced Search); the results of an earlier search (Search Within). Files on network shares like local ones. Folder searches read files without opening them (up to 10,000 per search) and skip binary files. |
| **Text** | literal text, or a [regular expression](https://tktail.dev/help/search/#regular-expressions) (TKTail Regex v1), each line tested on its own; **Aa** matches case. |
| **Fields** | `field = value` and `!=`, `>`, `>=`, `<`, `<=`, `contains`, `startswith`, `endswith`, `exists`, `missing`, `is null`, `is not null`. A field is named by its name, a dotted JSON path, a FIX tag or name, an HL7 reference (`PID-3`) or a role (`severity`, `timestamp`, `message` ...). Numbers compare as numbers, severities on the syslog scale (`severity <= error`). Formats with fields: [Built-in formats](https://tktail.dev/help/built-in-formats/), and [your own](https://tktail.dev/help/custom-formats/). |
| **Time** | any time, the last 15 minutes / hour / 24 hours, today, or between two times; each record by its own time ([Advanced Search](https://tktail.dev/help/bottom-panel/#advanced-search)). Go To a time: Ctrl+Shift+G ([Viewing logs](https://tktail.dev/help/viewing-logs/)). |
| **Combine** | all of / any of, groups inside groups (up to 32 conditions and groups, 4 levels), conditions per source ([The builder](https://tktail.dev/help/bottom-panel/#the-builder-several-sources-and--or)). |
| **Event logs** | in Find in All Open Files, Advanced Search and sequences, with the fields time, level, provider, event ID, record ID and message; Find in an event tab looks at the message, provider, event ID and level ([Finding events](https://tktail.dev/help/windows-event-log/#finding-events)). |
| **Sequences** | Temporal Search: 2 to 8 steps, each within a time after the one before (up to a day), joined by time only or by a key such as a request ID - across files, folders and event logs ([Sequences](https://tktail.dev/help/bottom-panel/#sequences-one-thing-then-another-in-time)). |
| **Results** | a search session in Search Results: every match with its source, line and time; Completed, Incomplete (with the reason) or Cancelled; Search Within; Run Again; export as TSV, CSV or JSON Lines ([Search Results](https://tktail.dev/help/bottom-panel/#search-results)). |
| **Keep** | Saved Searches (the question, also as a `.tktsearch.json` file) and saved results (the answer, a `.tktresults` file) ([Save the question, save the answer](https://tktail.dev/help/bottom-panel/#save-the-question-save-the-answer)). |
| **Command line** | `tktail open <file> --search <text> [--regex] [--case-sensitive]`; `tktail folder <path> --search-files <name>` or `--search-content <text> [--recursive]` - the search runs in the window ([Command line](https://tktail.dev/help/command-line/)). |

---

Source: https://tktail.dev/help/large-and-network-files/

# Huge files and network shares

## Huge files

TKTail is made for logs of many gigabytes. It never reads a whole file into memory: what you see is read when
you look at it, and memory stays small whatever the size.

- **Opening** does not read the file through: TKTail shows its end (LIVE) or its start (`--paused`) right away
  and builds the line index in the background.
- **The scroll bar** maps to the position in bytes, so it works the same for 1 KB and 100 GB. **Ctrl+G** goes
  to a line or a byte offset (`8GB` works); `tktail open huge.log --offset 8GB` from the command line.
- **Line numbers** are exact. For a very large file they appear once the background **line index** has reached
  that part of the file. Files up to 16 GB are indexed automatically (Settings > Monitoring > *Build the full
  line index automatically for files up to*); **View > Build Full Line Index** indexes any file on request.
  The status bar shows the index's progress.
- **Search** runs in the background in slices - the window never freezes, and Find shows *counting 42%* while
  it counts. **Esc** cancels a search; what it found stays.
- **Record times**: Go To Time and the Inspector use the times of the records already read; **View > Read the
  File's Times** reads the rest of the file's times in the background ([Records and time](https://tktail.dev/help/viewing-logs/#records-and-time)).
- **Long lines** stay one line: a record of hundreds of kilobytes wraps as one paragraph; only lines longer
  than 1 MB continue on a new row every megabyte.

## Files on network shares

A local file tells TKTail when it changes (Windows sends a notification), and TKTail also checks
it four times a second - that is **LIVE**. A file on a network share (a `\\server\share\...` path
or a mapped drive letter) often does not: shares deliver notifications late, merge them or send
none, and a server may report the new size only after its write cache is flushed. So TKTail
**checks** network files. A check asks only for the file's size; nothing is read until the file
has grown, and then only the new bytes.

How a file is followed is its **refresh mode** - in the Inspector, **Monitoring > Refresh** (click
the value, or **...** > **Change Refresh Mode...**):

| Mode | What TKTail does | Status bar |
|---|---|---|
| **Auto** (default) | A local file: notifications and a check every 250 ms (every 2 s while TKTail is hidden in the tray). A network file: notifications where the share sends them, and checks every second after a change, slowing down step by step (2, 5, 10 s) to every 30 s while nothing changes | `LIVE` (local), `AUTO 1 s` ... `AUTO 30 s` (network) |
| **Event** | Notifications only - the file itself is never checked; the lowest cost. Windows may report a change only when the writer's data reaches the disk, and some shares accept the request but never report a change; there new lines do not appear on their own (choose Auto or Poll). When notifications stop working (the share went away, the folder is gone), the status bar says `NO EVENTS`: TKTail only checks whether the folder can be reached again (after 1, 2, 5 ... s, at most every minute), restores the notifications and then catches up | `LIVE`, `NO EVENTS` |
| **Poll** | Checks at the interval you choose - 500 ms, 1, 2, 5, 10, 20 or 30 s, 1, 2, 5, 10, 15 or 30 min, 1 h - and no notifications. New lines appear within about that interval | `POLL 5 s` |

The Inspector also shows how changes are detected now, whether the file is on a network share,
the connection, and when TKTail last checked and last saw a change. Your choice is remembered for
the file's tab when TKTail restores your workspace, and for a file monitored in the background
([Alerts and monitoring](https://tktail.dev/help/alerts-and-monitoring/#monitoring-files-in-the-background)).
**PAUSED** stops only the view: the file is still checked, its new lines are read and your alerts
see them.

**When the share cannot be reached** (the server is down, the VPN dropped, the drive was
disconnected), the status bar shows **OFFLINE** and the tab says so; the lines already shown
stay. TKTail tries again after 1, 2, 5, 10 and 30 seconds and then every minute
(**RECONNECTING** while a try is under way). When the share is back, TKTail continues where it
was and reads only what was added meanwhile; a file that was replaced or deleted in the
meantime is handled like a rotation or a missing file; a log with the date in its name goes on to the newest file
of its series ([Rotating dated log files](https://tktail.dev/help/rotating-dated-logs/#files-on-network-shares)). A file deleted on a share that *can* be
reached is shown as missing, not offline. One slow or dead server never holds up your other
files.

---

Source: https://tktail.dev/help/rotating-dated-logs/

# Rotating dated log files

Many applications start a new log file every day, hour or minute and put the date in its name:
`app_2026-10-14.log`, then `app_2026-10-15.log`. TKTail treats these files as **one log**. When the
next file appears, TKTail opens it beside the current tab and keeps it LIVE. You do not have to
find and open the new file yourself.

## How it works

- **Open the newest file** of such a series. File > Open, Explorer's "Open with TKTail", drag and
  drop, Recent and `tktail open` all work the same way. TKTail reads the name and compares it with
  the other names in the folder. It reads names only and opens no other file.
- **When a newer file of the series appears**, it opens in a tab next to the current one, in the
  same pane, and becomes LIVE. These choices carry over to the new tab:
  - View As (also a custom format)
  - encoding
  - refresh mode
  - word wrap, line numbers and observation times
- The status bar says `SERIES → app_2026-10-15.log`. While a tab follows its series, its LIVE
  marker reads `LIVE · SERIES`.
- **The format carries on.** A format you chose with View As (a custom format too) carries to the next file. A
  format TKTail detected carries too while the new file - often empty when it becomes LIVE - has too little content to
  tell (the Inspector says *Previous file of the series*); once it has, its content decides. A custom format associated
  by **extensions** looks at the last extension of each name (`.001` for `app.log.20261014.001`): for such names,
  associate it by **file names** (`app.log.*`).
- **Who comes to the front:** the new file does, if the series tab was in front and LIVE.
  Otherwise nothing takes the focus. If you paused the old file to read it, it stays where you
  are, and the new file is LIVE in the next tab.
- **The previous file:**
  - In Free, the previous file closes once nothing has been written to it for a few seconds.
  - Trial and Pro keep previous files open next to the LIVE one, oldest on the left. Set how many
    in Settings > Monitoring > *Previous files of the series kept open* (default 2).
  - TKTail only closes tabs it opened for the series. A tab you opened yourself is never closed.
- **Opening an older file** of the series (yesterday's while today's exists) means you want to
  read yesterday, so TKTail stays on it. The Inspector names the newer file. Choose **On** (see
  below) to follow the series from there.
- **Order comes from what the name means:** date, then time, then number. `_9` comes before
  `_10`, and `31-10-2026` before `01-11-2026`. TKTail never uses alphabetical order or file
  times. Some cases are handled specially:
  - A file with an older date copied into the folder never moves LIVE backwards.
  - A file dated more than two days after today is ignored and noted in the application log.
  - When several new files appear at once (for example a share that was away overnight), TKTail
    goes straight to the newest one.
- **After a restart**, a tab that was following its series opens the newest file of the series.

## Names TKTail recognizes

TKTail reads the **whole file name**, not a name plus a fixed extension. The date, the time and the number can be
anywhere - at the start (`2026-10-14-api.log`), in the middle (`api-2026-10-14-part.log`), before the extension, or in
what Windows calls the extension:

| Files | One series, in this order |
|---|---|
| `app.log.20261014`, `app.log.20261015` | by date |
| `app.log.20261014.001`, `app.log.20261014.002`, `app.log.20261015.001` | by date, then the number - which starts again the next day |
| `app.20261014.log.001`, `app.20261014.log.002` | the date before `.log`, the number after it |
| `app_2026-10-14.log.9`, `app_2026-10-14.log.10` | 10 after 9: numbers are compared as numbers |
| `app.log.20261014.235959.001` | date, time and number, all after `.log` |
| `001.app.log.2026-10-14`, `002.app.log.2026-10-14` | a number before the name, the date at the end |

| Part | Forms |
|---|---|
| Date | `YYYYMMDD`, `YYYY-MM-DD`, `YYYY_MM_DD`, `YYYY.MM.DD`, `DD-MM-YYYY`, `DD_MM_YYYY`, `DD.MM.YYYY`. Month and day may have one digit (`2026-9-9`). Each date is checked against the calendar: `2026-02-29` and `2026-19-44` are not dates. |
| Time (optional, right after the date) | `HHmmss`, `HHmm`, `HH`, `HH-mm-ss`, `HH_mm_ss`, `HH.mm.ss`, `HH-mm`, `HH_mm`, `HH.mm`. Joined to the date by `-`, `_`, `.`, `T` or a space, or written straight after it (`20261014235959`). Hours, minutes and seconds are checked. Windows file names cannot contain `:`. |
| Number (optional) | A number on its own, between `_`, `-`, `.`, spaces or brackets, or at the start or end of the name. Also a number after `part`, `seq`, `segment`, `chunk` or `roll`. Examples: `app_2026-10-14_1.log`, `001_app_2026-10-14.log`, `app_2026-10-14.0001.log`, `app_2026-10-14_part2.log`, `app.log.20261014.009`. Leading zeros do not matter. The number can start again from 1 each day. |

A number counts as the rotation number only once the folder shows it changing between files of
the same date. Until then it is part of the name: `app_2026-10-14_123.log` alone could be a shard
or a process id. A number attached to a word, such as `server01`, `port1433` or `node2`, is always
part of the name.

Everything else in the name must stay the same - also the text around a dated suffix:
- `app_debug_2026-10-15.log`, `database_2026-10-15.log` and `app_2026-10-15.zip` are not the next
  file of `app_2026-10-14.log`; `app.zip.20261014.002` and `backup.log.20261014.002` are not the next file of
  `app.log.20261014.001`.
- Letters compare as Windows compares file names: case does not matter. Names in any language
  work (`zamówienia_2026-10-14_łódź.log`).

## When TKTail does not follow by itself

TKTail would rather not follow than follow the wrong file. These names are not followed
automatically:

- **Two-digit years and six-digit dates** (`14-10-26`, `261014`) are not read as dates - with one
  exception: **IIS log files** (`u_ex261105.log`, `ex261105.log`, the `in` / `nc` variants, hourly
  `u_ex26110509.log`) are recognized by that exact shape, the year being 20YY. An alert can name any other
  such series with a pattern of its own (`svc{YYMMDD}.log` - [AI integration](https://tktail.dev/help/mcp/)).
- **Month-first dates** (`10-14-2026`): TKTail reads day-first. If the folder holds names that
  only make sense month-first, the series is reported as ambiguous.
- **Two dates in one name, or two numbers that both change**, when the folder does not show
  which one rotates. Choose the reading yourself: Inspector > *Dated rotation* > *Pattern* lists
  every reading of the name.
- **Names with a number and no date** (`app.1.log`, `001_app.log`): logging libraries number such
  files both ways (`app.1.log` is the newest for one and the oldest for another). The usual case,
  a fixed name like `app.log` that is replaced, is covered by
  [ordinary rotation](https://tktail.dev/help/viewing-logs/#live-and-paused).
- **A name that only sometimes has a number** (`app_2026-10-14.log`, then
  `app_2026-10-14_1.log`): TKTail follows files shaped like the one you opened.
- **Numbered files written at the same time** (shards such as `app_2026-10-14_01.log` and
  `_02.log`, both growing) look like a sequence. Set the file to **Off**, or choose the reading
  without the number.

## Per file: Auto, On, Off

Click **Dated rotation** in the Inspector's TKTail section, or the Dated Series section's rows:

| Choice | What it does |
|---|---|
| **Auto** | Follows when the name is clearly dated and you opened the newest file, while Settings > Monitoring > *Follow dated file rotation automatically* is on (it is by default). |
| **On** | Follows this file's series, even with that setting off, and moves to the newest file now. |
| **Off** | Stays on this file. |
| **Pattern** | *Detected automatically*, or one of the readings of the name, shown like `app_{YYYY-MM-DD}_{N}.log`. |
| **Previous files kept open** | Trial / Pro: *Default*, or 0, 1, 2, 3, 5 or 10 for this file. |

The choice stays with the tab, also after a restart.

The **Dated Series** section shows:
- **Mode** and **State**, and **Why** when the file is not followed.
- **Pattern**, with where it came from: from the name only, confirmed by the files in the
  folder, or chosen by you.
- **Current:** the date, time and number of the LIVE file.
- **Next file:** *Waiting*, or the file being opened. TKTail retries while the writing
  application still holds the file.
- **Previous files kept**, **Last switch**, and **Folder** (how the folder is watched).

A previous file TKTail keeps open says so and names the LIVE file.

## Free and paid editions

Following the series works in **every edition**. Keeping previous files open beside the LIVE one
needs a Trial or Pro license. In Free the previous file closes when the next one is LIVE, and the
setting is shown as unavailable.

## Alerts, incidents and monitoring

- **An alert follows the series.** An alert made on `app_2026-10-14.log` watches
  `app_2026-10-15.log` once that file is LIVE, so you do not have to edit it every day. Incidents
  name the file the line was really written to.
- **Also without a tab, also after a restart.** An alert made while the file followed its series
  (Add Alert, or an AI client) keeps the series in its definition: TKTail keeps the newest file of it
  watched in the background - with the tab closed, hidden in the notification area, and after a restart,
  when the next day's file has appeared in the meantime. **Tools > Manage Alerts** shows the file each alert
  reads now (*Yes - app_2026-10-15.log (no tab)*). An alert made on a file that was not followed stays on
  that one file - a date in a name alone never changes what an alert watches.
- **Evidence across a switch:** records after the trigger continue in the next file of the
  series, and records before it come from the previous one. Each file is kept as its own part of
  the evidence, with its name. Positions are never mixed between files.
- **Before an older file is deleted:** a search's results are kept with **Save as Evidence** - an evidence package
  names each file by its identity, not only its name, and stays valid after the file is gone
  ([Saving evidence](https://tktail.dev/help/saving-evidence/#rotating-logs-pin-then-save)).
- **A monitored file** (*Monitor in Background*, `tktail monitor add`) follows its series without
  a tab. From then on the monitored entry names the current file.

## Files on network shares

A series on a share is watched like the share's files:
- TKTail uses notifications where the share sends them. Otherwise it checks the folder at the
  file's refresh mode, at most every 2 seconds.
- While the share is away, nothing waits for it.
- When the share answers again, TKTail goes to the newest file of the series.

See [Huge files and network shares](https://tktail.dev/help/large-and-network-files/).

## Settings

Settings > Monitoring > *Dated file names*:
- **Follow dated file rotation automatically** (default: on).
- **Previous files of the series kept open** (default: 2, from 0 to 50; Trial and Pro).

---

Source: https://tktail.dev/help/windows-event-log/

# Windows Event Log

TKTail shows the Windows Event Log next to your log files: Application, System, Security and the
*Applications and Services Logs* of this computer, and saved `.evtx` files. Open a log and you see
its recent events at once, then the new ones as Windows writes them (**LIVE**), one row per
event. Select an event to read its message, its fields and its XML.

TKTail only reads the Event Log. It never clears a log, never deletes or changes events, never
enables a disabled log and never asks for administrator rights. (The Event Log is not ETW: these
are the persistent logs Event Viewer shows, not high-rate trace sessions.)

## Opening an event log

In the [Explorer](https://tktail.dev/help/explorer/), expand **Windows Event Logs**:

```
Windows Event Logs
  Application
  Security
  Setup
  System
  Forwarded Events
  Applications and Services Logs
    Microsoft
      Windows
        PowerShell
          Operational
        ...
```

Saved `.evtx` files are files: they appear in folders under **Files**, like any other file, and
open from there. **Windows Event Logs** holds the logs of this computer.

- **Double-click** a log (or select it and press **Enter**) to open it: the newest 1,000 events,
  then LIVE. A log that is already open just gets its tab back.
- Right-click a log for **Open (Recent + LIVE)**, **LIVE Only** (no history: only events from
  now on), **Open with Filter...** (see [Choosing what to see](https://tktail.dev/help/windows-event-log/#choosing-what-to-see)) and
  **Properties** (type, enabled, log file, size, number of events, last write).
- **Drag** a log onto a pane to open it there, or near a pane's edge to open it in a new split
  beside what you look at; right-click > **Open in New Split** does the same next to the active
  pane ([Drag sources into the workspace](https://tktail.dev/help/viewing-logs/#drag-sources-into-the-workspace)). A log
  that is open already is shown, not opened twice.
- The list of logs is read when you first expand *Windows Event Logs* - TKTail does nothing with
  the Event Log until then. **Refresh** in the right-click menu reads it again.
- Analytic and Debug logs are hidden; right-click > **Show Analytic and Debug Logs** lists them.
  A disabled log is shown dim: TKTail does not enable logs.
- A log this account may not read is marked **access denied** (see [Permissions](https://tktail.dev/help/windows-event-log/#permissions)).

You can also open a log from the command line (`tktail eventlog open System`), and a saved
`.evtx` file with **File > Open** (choose *Saved event logs*), by dragging it onto TKTail or with
`tktail eventlog open C:\Logs\saved.evtx`. A saved file shows its events; it has no LIVE part.

## The event tab

The tab is named after the log (*System*, *PowerShell/Operational*); its tooltip shows the full
name, the computer and the filter.

```
Time                     Level        Provider                  Event ID  Message
2026-10-05 20:17:31.115  Information  Service Control Manager   7036      The Demo Service entered the running state.
2026-10-05 20:17:33.412  Error        Service Control Manager   7031      The Demo Service terminated unexpectedly...
```

- One row per event, oldest at the top, the newest at the bottom, where LIVE events arrive.
  Times are local times (the Summary shows the UTC time too).
- **Critical** and **Error** are drawn in the error colour, **Warning** in the warning colour,
  **Verbose** dim - the same colours as levels in log files.
- The message column shows the first part of the message on one line. Messages are prepared in
  the background, newest first: for a moment a row may show **…** instead.
- Rows can scroll sideways when the window is narrow (Shift+wheel, the horizontal scroll bar,
  Left / Right).

### LIVE and PAUSED

Like a log file, an event tab is **LIVE** (following the newest event) or **PAUSED**.

- Clicking a row, moving up with the keyboard or scrolling up pauses the view. New events keep
  arriving: the badge and the status bar count them (**PAUSED · +37 events**).
- **End**, **F5** or **Go Live** return to the newest event.
- **Stop Monitoring** (right-click) stops receiving new events; the rows stay. **Start
  Monitoring** continues right after the last event shown - nothing in between is skipped.
- A paused tab keeps receiving events, and it still keeps only its newest 100,000. When a busy log
  pushes out rows the paused view held, the badge and the status bar say so (**PAUSED · +12,400
  events · 2,400 older left the tab**), the Inspector shows *While paused*, and a search says those
  rows were not searched. They are still in Windows; **Go Live** shows the newest events.

The status bar shows the state (**LIVE**, **PAUSED +n**, **STOPPED**, **LOADING HISTORY**,
**RECONNECTING**, **ACCESS DENIED**; when LIVE cannot keep up also *catching up* or *overloaded* -
see [below](https://tktail.dev/help/windows-event-log/#when-a-log-writes-faster-than-tktail-reads)), the current event (*Event 1,002 / 1,002*),
the number of events in the tab and the LIVE rate in **events/s** (events, not lines), and the
filter (click it to change it).

### Rows that are not events

The tab says when something happened to the log itself, in a dim row:

| Row | Meaning |
|---|---|
| *Event log was cleared or reset* | The log was cleared while the tab was open (record numbers started again). Rows above are from before. |
| *LIVE reconnected - no events missing* | The connection to the Event Log service was lost and restored; TKTail continued after the last event it had. |
| *LIVE resumed without a bookmark - events may be missing here* | It could not continue after the last event (the log was cleared or overwritten in between). |
| *LIVE skipped ahead to stay current · 94,812 events (records ...)* | The log wrote faster than TKTail could read for a while; TKTail continued from the newest events. The row names the records it passed over - they are still in the Windows log (see [below](https://tktail.dev/help/windows-event-log/#when-a-log-writes-faster-than-tktail-reads)). |
| *Monitoring stopped* / *started again* | You stopped or started monitoring. |

### How much a tab keeps

A tab keeps the newest **100,000** events (about 64 MB at most); older ones leave the tab - they
stay in Windows, of course. The Inspector shows how many rows the tab has and how many left it.

### When a log writes faster than TKTail reads

A tab reads every event as long as it can keep up - thousands per second. When a log writes faster
for a long time (a program or script in a loop), TKTail stays responsive and says what happened:

- The status bar says it in words: **LIVE · catching up (4 s behind)** while TKTail works through
  waiting events, **LIVE · overloaded, 12,400 skipped** after it had to continue from the newest
  events (and **LIVE · 12,400 skipped** later). Its tooltip and the Inspector (*Keeping up*,
  *Skipped*, *Source gaps*) give the numbers.
- After about **10 seconds** behind, LIVE **skips ahead** to the newest events. A row says exactly
  what was passed over - the number of events, their record numbers and when they were written.
  They are still in the Windows log. With a filter the number is an upper bound ("up to"): not
  every record in the range matches the filter.
- During a flood, messages are prepared for the rows on screen (and for searches and exports), not
  for every event that arrives - and while LIVE moves faster than they can be prepared, its rows show
  **…**; pause the tab to read them.
- A full log overwrites its oldest events. If it overwrote events before TKTail read them, the tab
  shows *LIVE resumed without a bookmark - events may be missing here* - those events are gone
  from Windows too. The Inspector counts them as *Source gaps*.
- A search over a tab with such rows says so: Find adds *the tab has 1 gap*; Find in All Open
  Files and Advanced Search report the search as *Incomplete*. The same when a flooded tab let
  events go (its 100,000 rows) before the search reached them - *n events left the tab before the
  search reached them*: pause the tab or stop monitoring to search a fixed set of events.
- Evidence an alert keeps of an event log is *Partial* when the log no longer holds the start of
  its time window.

## The selected event: Summary, Fields, XML

Select an event and open the **RECORD** view in the bottom panel (Enter, or double-click a row).
It shows the event in the same panes it uses for log records:

- **Summary** (the default): the level and provider, the time (local and UTC), channel,
  provider, event ID, task, computer, user, process and thread, record ID, the **message** and
  the first fields of the event's data.
- **Fields**: every field Windows recorded - `TimeCreated`, `Level` (with the provider's own
  name of the level - names of levels, tasks, opcodes and keywords come from Windows, in its display
  language), `Provider`, `EventID`, `Task`, `Opcode`, `Keywords`, `EventRecordID`,
  `Channel`, `Computer`, `UserID`, `ProcessID`, `ThreadID`, `ActivityID`, `Version`, the message
  and the event's data (`EventData` with its names; unnamed values as `Data[1]`, `Data[2]` ...;
  `UserData` as paths such as `LogFileCleared.SubjectUserName`). Fields Windows did not record
  are not shown.
- **XML**: the event exactly as Windows renders it, indented for reading.

The **Inspector** shows the same event's fields, and above them the source (channel, computer,
history, filter, state) and the tab's numbers (rate, delivery time, how LIVE keeps up, retention, skipped
events and gaps, memory).

**No message?** Some events have no message text on this computer: the program that wrote them
is not installed here, its message resources are missing, or the log comes from another
computer. TKTail then shows the event's own data as the message ("*Event data*"); the event is
complete otherwise.

## Choosing what to see

**Filter Events** chooses which events the tab shows. Open it with right-click > **Filter...**,
by clicking the filter in the status bar (*All events* when there is none), or from the Explorer:
right-click a log > **Open with Filter...**.

| Field | Shows only events ... |
|---|---|
| Levels | of the checked levels: Critical, Error, Warning, Information (includes *LogAlways*, as in Event Viewer), Verbose. None checked: every level. |
| Provider | of these providers - pick one of the tab's providers from the list or type names; several are separated by `;` |
| Event IDs | with these IDs: `7031`, ranges `7034-7036`, several separated by commas; a leading `-` excludes (`-1000`) |
| Text | whose message, provider or event ID contains the text (not case-sensitive) |
| Advanced | that match your own Event Log XPath query, which replaces levels, providers and IDs |

Below the fields the dialog shows the query Windows runs for them, as you type. A mistake (an
ID above 65535, a reversed range) is shown there in red and OK keeps the dialog open. **Clear**
empties every field.

Levels, providers and event IDs are filtered by Windows itself, so a filter on a big log does not
read every event. The text is matched by TKTail while the events are read: their messages are
formatted for it, which is slower on a big log - combine it with a level or provider when you can.

**Advanced**: tick it to edit the XPath yourself - it starts with the query of the fields above.
Write one XPath expression, as in Event Viewer's *XML* tab between `<Select ...>` and
`</Select>`. Two examples for the System log:

```
*[System[(Level=1 or Level=2) and TimeCreated[timediff(@SystemTime) <= 86400000]]]
*[System[Provider[@Name='Service Control Manager']] and EventData[Data[@Name='param4']='BITS']]
```

The first shows critical and error events of the last 24 hours; the second the events of the
Service Control Manager about the BITS service (field `param4` holds the service's name - the
Fields view shows the names of an event's data).

A whole `<QueryList>` is not accepted: it can name other logs, and a tab shows exactly one.
Windows checks the XPath when the tab runs it; if it is not valid the tab says so (*The query is
not valid Event Log XPath: ...*) - open Filter Events again to correct it.

Changing the filter starts the tab again with the new query; rows of the old filter never mix
with the new ones. The current filter is in the status bar, the tab's tooltip and the Inspector.

Right-click an event for quick filters and the history:

| Item | What it does |
|---|---|
| Show Only Provider "..." | Only events of this provider |
| Show Only Event ID ... | Only events with this ID |
| Show Only Level ... | Only events of this level |
| Clear Filter | All events again |
| History > LIVE only / Last 100 / Last 1,000 / Last 10,000 / Available history | How much history the tab reads |
| Refresh | Read the history again |
| Show Metrics Around This Event | A Metrics View beside the tab, paused at the event's time - CPU, memory, disk or a process then (Trial / Pro; [Metrics](https://tktail.dev/help/metrics/#from-a-log-to-metrics)) |

## Finding events

**Ctrl+F** in an event tab opens the find bar. A search looks at each event's **message**, its
**provider**, its **event ID** and its **level** (Match case, regular expressions and Wrap as for
files); the first event that matches is selected, the tab pauses and the match is highlighted
in its row. The find bar says where the match is (*Found in the message*, *in the provider* ...).
**F3** / **Enter** finds the next event, **Shift+F3** the previous one. Without a selected event
the search starts at the events on screen (in LIVE: the newest).

- A search covers the events the tab holds (up to 100,000) and up to the first 8,192 characters of
  each message (what the tab keeps of it). To search the whole log on the computer, use Filter
  Events or `tktail eventlog query --text`.
- Messages that are still being prepared are prepared first - a search never skips a message.
  If Windows does not provide a message within 15 seconds, the search continues without it and
  says how many events were searched without their message.
- Field conditions (`level = ERROR`) are for log records; for events use Filter Events.

**Find in All Open Files** (**Ctrl+Shift+F**, or the search box in the toolbar) and
[Advanced Search](https://tktail.dev/help/bottom-panel/#advanced-search) search the open event tabs too - in the
background, so a large tab never holds up the window, with a time range if you set one (an
event's time is its TimeCreated). Their results show the log's name, the event (time, level, provider, ID and the
message around the match) and the log (`eventlog://local/System`) where a file shows its path -
an event has no line number. Double-click a result (or press Enter) to go to its tab with the
event selected; if the event has left the tab in the meantime, the status bar says so. *Copy
Match* copies the matched text, *Copy Source URI* the log's address.

## Copying

| Command | Copies |
|---|---|
| Copy Event / Copy *n* Events (Ctrl+C) | The selected events, one per line, with their complete messages |
| Copy Message | The selected event's complete message |
| Copy Fields | Its fields, one per line (name, value, meaning) |
| Copy XML | Its XML |
| Copy Event ID / Copy Provider | The value alone |

Select several events with Shift+click, Shift+arrows or Ctrl+A. When some messages are still
being prepared, Copy waits for them (the status bar says so) - copies never contain "…".

## Exporting

Right-click > **Export Events...** (or **File > Export** while an event tab is active) writes the
events to a file: **TSV**, **CSV** or **JSON Lines**, all events of the tab or only the selected
ones. Each event is one row with the columns `Time` (local), `TimeUtc`, `Level`, `Provider`,
`EventID`, `RecordID`, `Task`, `Opcode`, `Keywords`, `ProcessID`, `ThreadID`, `Log` (the channel,
or the saved file's path) and `Message`.

Messages are complete: the export first prepares every message the tab has not prepared yet
(the status bar counts them down). A message longer than the 8,192 characters a tab keeps, an
event the log no longer holds and a message Windows did not provide in time are marked in the
file (`[message continues: ...]`, `[message not formatted in time]`) - never cut silently. Rows
such as *Event log was cleared* are exported too (`-- Event log was cleared or reset`), so a gap
in the events stays visible. TSV has no room for a tab or a line break inside a value: there they
become spaces (CSV and JSON Lines keep the message exactly). Saving events as a native `.evtx`
file is not available.

## Keyboard

Up / Down, Page Up / Page Down, Home move the current event (Shift extends the selection); End
returns to LIVE; Left / Right scroll sideways; Ctrl+A selects all events; Ctrl+C copies them;
Ctrl+F / F3 / Shift+F3 find; Enter opens the event in RECORD; Ctrl+wheel zooms like the file viewer.

An AI assistant reads and searches the event logs open in TKTail - open System or Application yourself when the
investigation needs them; it cannot open a channel on its own ([AI assistance](https://tktail.dev/help/ai-assistance/#metrics-and-windows-events)).

## Permissions

Application, System and most *Applications and Services Logs* can be read by every user.
The **Security** log can only be read by administrators and members of the **Event Log
Readers** group. Without that right TKTail shows *Access denied* in the tab and in the tree;
nothing else is affected. TKTail never elevates itself: to read Security, run TKTail as a member
of Event Log Readers (an administrator can add your account), or as administrator if your
organization allows it.

## Command line

```
tktail eventlog list                                    the logs of this computer (--all: Analytic and Debug too)
tktail eventlog open System                             open a tab: the newest 1,000 events, then LIVE
tktail eventlog open Application --last 100 --level error,warning
tktail eventlog open System --live                      only new events
tktail eventlog open System --since 2h --provider "Service Control Manager"
tktail eventlog open C:\Logs\saved.evtx                 a saved log (history only)
tktail eventlog query System --last 20 --level error    print events (no window)
tktail eventlog query Application --id 1000 --output json
```

`eventlog query` prints the newest matching events, oldest first; it exits with 1 when no event
matches and 4 when access is denied. Details: docs/CLI.md.

## Troubleshooting

| What you see | What to do |
|---|---|
| *Access denied* | See [Permissions](https://tktail.dev/help/windows-event-log/#permissions). |
| A log is missing in the tree | It may be Analytic or Debug (right-click > Show Analytic and Debug Logs), or installed after the tree was read (Refresh). |
| *RECONNECTING* | The Event Log service did not answer (restarting, very busy). TKTail retries after 1, 2, 5, 10 s and then every 30 s, and continues after the last event it had. |
| *LIVE · overloaded, n skipped* | The log writes faster than TKTail can read; TKTail continued from the newest events. See [When a log writes faster than TKTail reads](https://tktail.dev/help/windows-event-log/#when-a-log-writes-faster-than-tktail-reads). A filter on level or provider lets TKTail read fewer events. |
| *Event data* instead of a message | The program that wrote the event has no message text on this computer (see above). |
| Rows show **…** | Messages are prepared in the background, visible rows first; they appear within moments. |
| A saved `.evtx` shows some events without a message, or their details as *no longer in the log* | The file combines events of several logs. TKTail finds an event in a saved file by its position, which needs record numbers that rise through the file - as in every file Windows saves from one log. Open the original logs, or files saved from one log each. |

## Not available yet

Event logs of other computers, saving events as `.evtx`, and alerts on events (alerts watch log
files).

---

Source: https://tktail.dev/help/metrics/

# Metrics (Windows Performance Counters)

Logs say what an application reported; **metrics** show what the machine and its processes were
doing at the same time - CPU, memory, disk, network, a process's CPU, memory, threads or handles.
TKTail reads them from **Windows Performance Counters** and shows them beside your logs on the same
clock, so an ERROR at 14:32:07 can be compared with the CPU and memory of 14:32:07 - in the same
window, without a separate monitoring tool. Metrics is made for that local investigation: what
happened on this PC around an incident. It is not a monitoring platform - it keeps no long-term
history and collects nothing from other computers.

- **Nothing is collected until you choose counters.** Browsing the list of counters samples
  nothing.
- History is kept **in memory only** - the last 15 minutes by default (5, 15, 30 or 60) - and
  starts when a counter is first collected: there are no metrics for earlier times. Nothing is
  written to disk.
- Metrics need a **Trial, Pro or Developer license**. Without one the commands stay in the menus,
  marked *(Pro)*, and explain this when chosen; the log viewer works as before.

## Logs and metrics in one window

A Metrics View is a tab like a log, so the workspace shows both at once: the machine on one side,
the application on the other, both LIVE. Put them side by side the way you split logs:

- open the log, then the metrics (**View > Metrics...** or **Tools > Metrics > Open Metrics: Host
  Basics**) and choose **Layout > Move Tab to New Split > Right** - or drag the Metrics tab to the
  edge of the log's pane ([Tabs and splits](https://tktail.dev/help/viewing-logs/#tabs-and-splits));
- from the command line, a log beside the metrics already open: `tktail open orders-api.log
  --split-right`.

The chart's time axis is this PC's local time: a log written on this PC with local timestamps lines
up with it directly. Splits, tabs and bottom panels work as for logs: a second log, an event log or
the RECORD view below.

**An investigation, step by step:**

1. Open the application log - it follows the file LIVE.
2. Open Metrics beside it (Host Basics, or a set of your own) and keep both LIVE while the problem
   happens.
3. When the log shows errors, look left: was the CPU saturated, memory short, the disk or the
   network busy at that moment?
4. Drag across the interesting part of a chart: the view pauses on that range and every lane shows
   its minimum, average and maximum there.
5. Right-click > **Search Logs and Events in This Range...** - the Advanced Search with that time
   range and your open logs and event logs as sources.
6. Select an ERROR record: the **RECORD** view (**View > Tool Views > Record**) shows its fields;
   from a record, **Show Metrics Around This Time** moves the metrics to its moment (below).
7. Keep what worked: **Save as Metric Set...** for the counters, and an [alert](https://tktail.dev/help/metrics/#metric-alerts)
   that watches a counter or the log for next time.

### From a log to metrics

Right-click a record (or an event in an event tab) > **Show Metrics Around This Time** (also
**Tools > Metrics**). TKTail opens a Metrics View beside the log, paused on that record's time with
the cursor on it - or moves a Metrics View already shown beside it. The new view shows the METRICS
panel's counters, or Host Basics when that list is empty. Records need a complete date and time; a
time older than the history kept says so.

### From metrics to logs

Drag a range in a Metrics View (for example a CPU spike), right-click > **Search Logs and Events
in This Range...**: the **Advanced Search** opens in the bottom panel with that time range and the
open files and event logs as sources. Choose what to look for, then **Search**. With only a cursor,
the search covers the 30 seconds before and after it.

Metrics and searches meet by **time**, never by a condition: a search looks for records, not for
counter values - there is no "ERROR and CPU over 90 %". Put the two side by side, or search the
range a chart shows.

## What you can watch

TKTail ships five Metric Sets - saved selections of counters - and you can make your own from any
Windows Performance Counter on the PC. The built-in sets cannot be changed or deleted; **Save As**
makes your own copy.

| Scenario | Metric Set | Counters (as the lanes name them) | Asks for |
|---|---|---|---|
| Host | **Host Basics** | CPU (total), Available memory, Committed memory, Disk throughput | - |
| System | **System Pressure** | CPU (total), Processor queue length, Available memory, Committed memory, Paging, Context switches | - |
| Process | **Process Diagnostics** | CPU (a share of the machine, as Task Manager shows it), private bytes, working set, threads, handles, I/O throughput | a process |
| Disk | **Disk & I/O** | Read throughput, Write throughput, Reads, Writes, Read latency, Write latency, Queue length | a disk (all disks preselected) |
| Network | **Network** | Network throughput, Received, Sent, Packets | a network interface |
| Custom | **your own** | any counters you pick, of any objects | - |

Units follow the counter: a count, percent, bytes, bytes per second, per second or seconds - bytes
shown as KiB, MiB or GiB.

### Host Basics

The quick health check of the PC, one click away (**Tools > Metrics > Open Metrics: Host Basics**):

| Lane | Counter | What it tells you |
|---|---|---|
| CPU (total) | `\Processor Information(_Total)\% Processor Time` | How busy all processors are. A saturated CPU slows every request on the machine |
| Available memory | `\Memory\Available Bytes` | Memory free for new work now. When it runs low, Windows pages and everything slows down |
| Committed memory | `\Memory\% Committed Bytes In Use` | How much of the commit limit (memory plus page file) is promised to processes. Near 100 %, new allocations fail |
| Disk throughput | `\PhysicalDisk(_Total)\Disk Bytes/sec` | Bytes read and written per second, all physical disks together |

### Process metrics

**Process Diagnostics** (**Tools > Metrics > Open Metrics: Process Diagnostics...**) watches one
process: its CPU, private bytes, working set, threads, handles and I/O throughput. It asks which
process (the running ones are listed; type to filter):

- **Follow by name** (the default) keeps the series when the process restarts: a new process of that
  name continues the same lanes, the restart is marked, and the METRICS panel says *restarted
  (another process)*. A rate is never computed across two processes - the first sample of the new
  one is a warm-up. A name that is not running yet is collected when it starts.
- **Pin this process** watches exactly that PID: when it exits, the series ends (*unresolved* in the
  picker - **Choose Process** binds it to a running one).

CPU of one process is a share of the whole machine: on a PC with many cores even a busy process can
stay at a few percent. **Fit Percent Lanes to Their Data** (right-click the view) scales a percent
lane to its values.

### Network metrics

**Network** asks for the network interface (a disk set asks for the disk the same way) and shows
its traffic in bytes per second - **Network throughput** (received and sent together),
**Received**, **Sent** - and **Packets** per second.

## Opening metrics

**View > Metrics...** opens the counter picker (*Metrics - Windows Performance Counters*). The
quickest way is a Metric Set:

1. Choose a set in **Metric Set** at the top - a built-in one or one of yours.
2. **Load** puts its counters into **Selected** (nothing is collected yet). A set that observes a
   process, a disk or a network interface asks which one first.
3. Adjust the selection (and the colors) if you like, then **Open** (or **Add** - see below).

With nothing selected, **Open** applies the chosen set at once. **Host Basics** and **Process
Diagnostics...** at the bottom do the same in one click.

**Picking counters yourself**: an **Object** (*Processor Information*, *Memory*, *Process*, ...),
one or more **Counters** and, where the object has them, **Instances** (Ctrl / Shift for several).
Names appear in this Windows's language, in English or both (**Show names** - see *Counter names*
below); **Find** matches either, whichever is shown - *Private Bytes* finds *Bajty prywatne* on a
Polish Windows.
**Add to Selection** (or double-click a counter or an instance) puts them into **Selected**; with
nothing in Selected, Open takes what the lists show.

**Selected** lists every counter with its **Color** (a swatch: Auto or yours - click it to change
it) and its **State**: *available*, *not running now* (a process
followed by name - collected when it starts), *unresolved* (pinned to a PID that is gone - select
it and use **Choose Process** to bind it to a running process), or *not on this computer* (the
counter, its object or its instance does not exist here - another computer may have it; it stays
in the set and is simply not collected). **Remove** (Delete) and **Clear Selection** change the
selection only, never a saved set.

**Your own Metric Sets**:

- **Save As...** keeps the selection as a new set with a name and an optional description - for
  example *Orders Investigation*: CPU, available memory and disk throughput of the PC, the CPU and
  private bytes of the service's process, and the network traffic. Next time: View > Metrics...,
  choose it, Open.
- **Save** writes the changed selection and its colors back into the loaded set (a set with unsaved
  changes shows `*` after its name above the selection). A built-in set is never saved over.
- **Manage...**: Revert to Saved (the loaded set's counters and colors again), Rename, Duplicate,
  Delete (with a confirmation), Open Metric Sets Folder.
- Your sets are listed under *My Metric Sets*, below the built-in ones, and kept in
  `metric-sets.json` in TKTail's data folder. They are stored by their English counter names, so
  they work on another computer and in another Windows language (see *Counter names*); a process,
  disk or interface that does not exist there shows as unavailable or unresolved.

The picker can be resized and maximized - the three lists share the extra width, the selection the
extra height - and a name that does not fit shows in full in a tooltip. TKTail remembers its size
and position (on a monitor that still exists).

The counters open in a new **Metrics View** tab named after the set (*Metrics: Host Basics*,
*Metrics: PaymentService*, *Metrics: Orders Investigation*). If a Metrics View is the active
tab, the picker's button says **Add** and adds to it instead. The same entries are in **Tools >
Metrics** (*Open Metrics: Host Basics*, *Open Metrics: Process Diagnostics...*, *Add
Counters...*), and the **SYSTEM** panel has a Metrics button. **Tools > Metrics > Open Metric
Set...** lists the built-in sets and yours and opens one directly.

### Counter names

Windows names its counters in its own language: *Bajty prywatne* on a Polish Windows is *Private
Bytes* on an English one. TKTail shows them the way you choose - **System language** (the default),
**English**, or **System language + English** (*Bajty prywatne [Private Bytes]*, handy when you
follow English documentation). Choose it in the picker (**Show names**), in **Tools > Metrics >
Counter Names**, or from the right-click menu of a Metrics View or the METRICS panel; every open
view follows at once. It changes only the names you see - the counters, their history and your
sets stay as they are.

Hover a series name in a Metrics View, a row of the METRICS panel or an entry in the picker for
both names and the counter path. Labels of the built-in sets (*CPU (total)*, *Available memory*)
are TKTail's own names and stay the same in every form. Process, disk and interface names (the
instances) are names of things, never translated. A provider that has no English names keeps its
own and says so.

To give a series a name of your own - *Qlik Engine RAM* for a process's private bytes -
right-click it > **Series Name...** (in a Metrics View, or on a row of **Selected** in the picker).
The name is saved with the Metric Set, like its color; leave it empty to go back to the counter's
name.

**Your sets on another computer.** A Metric Set keeps the language-neutral identity of every
counter (the English name, and the GUID where Windows has one), never the names of your Windows's
language. Made on a Polish Windows, it opens on an English one with the same counters - shown in
English there; a counter that computer does not have shows as *not on this computer*.

## The Metrics View

Each counter gets a **lane** on one shared time axis: its name and current value, and the minimum,
average, maximum and change of what is visible (or of the selected range). Series of different
units never share a scale. A gap in collection is drawn as a gap, a sample that could not be read is
marked below the line, and **no earlier data** marks the time before collection started.

The header shows **LIVE / PAUSED**, the time window, the cursor or range, and how often the view
collects. The tab names what it shows (*Metrics: Host Basics*, *Metrics: Host Basics +
PaymentService*, *Metrics: 9 counters*) and follows when you add or remove counters.

**Time windows.** The header's buttons choose how much of the past the view shows: **30 s**,
**1 min**, **5 min**, **15 min**, **30 min** or **60 min**. LIVE keeps the newest sample at the right
edge; scroll back in time as far as the history kept (**Keep History** in the METRICS panel: 5, 15,
30 or 60 minutes) - a window longer than what was collected shows *no earlier data* for the rest.
How often counters are read is **Collect Every** 1 (the default), 2, 5, 10 or 30 seconds.

| Action | How |
|---|---|
| Pause / go live | Click **LIVE** in the header, **Space**, **Shift+F5** / **F5**, or **End** (go live). Pausing stops the display only - collection continues |
| Time cursor | Click in a chart; the values at that time are what **Ctrl+C** copies |
| Select a range | Drag in a chart (the view pauses); its statistics show in every lane; **Esc** clears cursor and range |
| Move in time | Mouse wheel (up = older), **Left** / **Right** (Ctrl: further), **Home** (the oldest kept) |
| Time window | The buttons in the header, **Ctrl+wheel**, **+** / **-** |
| Many lanes | **Shift+wheel** or the scroll bar; **Up** / **Down** select a series |

Right-click the view for: *Search Logs and Events in This Range...* (above), *Copy the Values* /
*Copy the Range's Statistics*, *One Lane per Unit* (series of one unit together), *Fit Percent
Lanes to Their Data*, **Series Color** (below), *Hide the Selected Series* / *Show All Series*,
*Remove the Selected Series*, *Add Counters...*, *Collect Every* 1 / 2 / 5 / 10 / 30 s, and the
Metric Set commands (below).

### Series colors

Every series starts in **Auto**: a color of TKTail's palette, by its place in the view - the same
set opens with the same colors, and series sharing a lane never get the same one. To give a
series a color of its own, right-click its name (or its lane) > **Series Color** and pick one of
the ten preset colors, **Custom...** (the Windows color dialog) or **Auto** to go back; **Reset All
Series to Auto** is at the end of that menu. In the picker, click a row's swatch in **Selected**
(or right-click the row) for the same choices before you open the set.

A color only changes how the series is drawn - the counter, its history and its collection stay as
they are. A chosen color stays yours in both themes; one too close to the background (yellow on
white) gets a thin outline instead of being replaced. Colors tell series apart; states never
depend on them alone (warming up, missing and errors are drawn as patterns and named in the lane).

### Saving a view as a Metric Set

What a Metric Set remembers: its counters in their order, the process / disk / interface they
observe, each series' color (Auto or yours) and *One Lane per Unit*. What it never remembers: the
time window, the cursor or range, LIVE / PAUSED, hidden series - those belong to the open view.

- **Save as Metric Set...** keeps the view as a new set (name, optional description); the view
  belongs to that set from then on.
- A view opened from one of your sets shows `*` on its tab once its counters, colors or lanes
  differ from the set. **Save to "&lt;set&gt;"** writes them back; **Revert to Saved Set** brings the
  set's counters and colors back.
- A view of a built-in set (Host Basics, ...) is never saved over: **Save as Metric Set...** makes
  your own copy, for example *My Host Basics* with CPU in red.

Two sets of the same counters open as two tabs, each with its own colors - and still one
collection per counter.

The status bar shows LIVE / PAUSED, the cursor or range, how many metrics the view collects and
how often (the tooltip adds the collection's memory and its last duration).

## Metric alerts

An alert can watch a counter instead of a log: **Tools > Manage Alerts... > New Metric Alert...**
(or *A performance counter* in the Alert dialog). Choose the counter (**Choose...** opens the
picker), a comparison (`>`, `>=`, `<`, `<=`, `=`, `!=`) with a threshold (`90`, `90 %`, `4 GiB`) and
how many seconds it must hold without a break (0: one sample decides) - for example *CPU (total)
> 90 % for 30 s*. It fires once when the condition becomes true and again only after it was false
in between; a sample that could not be read never counts either way. Any alert - one on a log too -
can keep a Metric Set's samples of the minutes around the moment as **evidence** in its incident.
Details: [Alerts and monitoring](https://tktail.dev/help/alerts-and-monitoring/).

## The METRICS panel

**View > Tool Views > Metrics** (or **Tools > Metrics > METRICS Panel**) shows a table of every
counter being collected: its current value, minimum / average / maximum and a sparkline of the
last 5 minutes, its state, and which views collect it (*Collected for*).

The panel has its **own list** too: counters you add here are collected from TKTail's start for
as long as they stay on the list (it is saved with your settings) - useful for "always show me
CPU and the service's memory". The panel's buttons and right-click menu: **Add counters** (+ - the
picker with its Metric Sets), *Add Host Basics*, *Add Process Diagnostics...*, **Open in New
Metrics View** (Enter), **Pause** the display, **Remove** (Delete), *Remove Stopped Metrics*,
**Copy**, *Collect Every*, and *Keep History* 5 / 15 / 30 / 60 minutes (for all metrics).

**From the panel into a Metrics View.** Select one or several rows (Ctrl+click, Shift+click,
Ctrl+A) and:
- right-click > **Add to Active Metrics View** - the Metrics View in front, else the one you used
  last, else a new one;
- right-click > **Add to Metrics View** > one of the open Metrics Views, or *New Metrics View*;
- **Open in New Metrics View** (Enter) - a view of just those metrics;
- or **drag** the rows: onto a Metrics View they join it; onto a log pane, an empty area or a pane's
  edge they open in a new Metrics View there ([Drag sources into the
  workspace](https://tktail.dev/help/viewing-logs/#drag-sources-into-the-workspace)).

A metric that is in the view already is not added twice (it is selected instead), and the view keeps
collecting through the same stream - adding a view never starts a second collection of a counter,
and the history TKTail kept is shown at once. A *stopped (history kept)* metric can be added too: the
view shows its history and its state, never a value it does not have. Where the new series is drawn
follows the view: with **One Lane per Unit** it joins the lane of its unit, otherwise it gets a lane
of its own - a value never lands on another unit's axis (the status bar says which while you drag).
The rows stay selected, so the next view is one more click. Adding to a view opened from one of your
Metric Sets marks it changed (`*`): **Save to "&lt;set&gt;"** keeps the change, **Revert to Saved Set**
undoes it; a built-in set never changes - **Save as Metric Set...** makes it yours.

**Removing metrics.** Select one or several rows - Ctrl+click, Shift+click, Ctrl+A - and press
**Delete** (or right-click > *Remove Metrics*; a right-click on a selected row keeps the
selection). The selection stays on the same metrics while the table updates every second.
- A counter on the panel's own list leaves it.
- A stopped metric (*stopped (history kept)* - for example the counters of a process whose view
  you closed) is removed with its history; **Remove Stopped Metrics** does that for all of them.
- A metric a Metrics View still collects stays for that view (the status bar names it) - remove it
  in the view, or close the view.

Removing rows never changes a saved Metric Set: open the set again and its counters come back.

| State | Meaning |
|---|---|
| ok | Read at the last collection |
| waiting for the first sample | Nothing has been read yet |
| warming up | Rates (CPU, bytes/s) need two readings - the first value comes one interval later |
| stale | No new sample for longer than expected |
| restarted (another process) | A followed process was restarted; the series continues, marked |
| not running | The process (the counter's instance) is not running now |
| access denied | Windows does not let this user read the counter |
| unavailable | The counter cannot be read now (the tooltip says why) |
| stopped (history kept) | Nothing collects it any more; what was collected stays until it ages out |

## Metrics for an AI assistant

An assistant connected over [MCP](https://tktail.dev/help/mcp/) can read the same metrics: list the Metric Sets and the
metrics TKTail keeps, a metric's current value and its samples, and a summary of an interval - for
example the CPU of the minutes around an error it is looking at. It reads only what TKTail already
collects; with your permission it can also save or delete your Metric Sets. These tools need the
Metrics feature of your license, like the views. How metrics fit into an investigation with an assistant:
[AI assistance](https://tktail.dev/help/ai-assistance/#metrics-and-windows-events); the tools and their arguments:
[MCP tool reference](https://tktail.dev/help/mcp-tools/).

## Linked windows

The METRICS panel's own list is collected once, by the main window; a linked window says so in
its panel and **Open in Metrics View** shows the list there. Metrics Views opened in a linked
window collect in that window. See [Linked windows](https://tktail.dev/help/windows/).

## What it costs

Counters are read on a background thread, once per interval for all views together - three views
of the same counter are one collection. A hidden Metrics View does not draw; a visible one draws
when new samples arrive.

What matters is **which kind of counter**, not how many: Windows reads a whole counter object at
a time. Processor, memory and disk counters (Host Basics) cost next to nothing. Counters of the
**Process** object (Process Diagnostics, any process counter) and of the **System** object
(System Pressure's queue length and context switches) make Windows gather the list of all running
processes at every collection, so their cost grows with how busy
the PC is - measured from about 4 ms of CPU time per collection (450 processes) to about 60 ms
(820 processes with 38,000 threads), i.e. from under 1 % to about 6 % of one CPU core at *every 1
s*, the same for one or twenty such counters. When you watch process counters for longer on a busy
PC, **Collect Every** 2-5 s lowers that in proportion. A hidden Metrics View costs nothing; a
visible one redraws once per collection. Measured numbers:
PERFORMANCE.md.

---

Source: https://tktail.dev/help/built-in-formats/

# Built-in formats

TKTail reads 35 log and data formats without any setup, plus plain text and two generic parsers you configure yourself. This page lists every format of this version, straight from the program's format registry.

How TKTail chooses the format of a file: what you pick with **View > View As** comes first, then a folder's [`.tktail` file](https://tktail.dev/help/local-configuration/), then your [own formats](https://tktail.dev/help/custom-formats/) that name files like it, then detection from the content, then file-name hints - otherwise the file is plain text ([the whole order](https://tktail.dev/help/local-configuration/#the-order-tktail-follows)). The Inspector says which format was chosen and why ([Inspector](https://tktail.dev/help/inspector/)).

Your format is not here? Make it in the Custom Format Studio from a sample of your log: [Your own log formats](https://tktail.dev/help/custom-formats/).

38 formats: 23 implemented, 15 partial.

## Reading the tables

- **ID** - the name on the command line (`tktail open app.log --format jsonl`); a `.tktail` file and AI clients write it as `builtin:<id>`.
- **Multi-line** - one record can span several lines (a stack trace stays with its error), shown and searched as one.
- **Fields** - the RECORD view and the Inspector show the record's fields.
- **Field search** / **Field alerts** - search and alert conditions on the fields ([Search](https://tktail.dev/help/search/), [Alerts and monitoring](https://tktail.dev/help/alerts-and-monitoring/)).
- **Status** - *implemented*: the format works as described; *partial*: it works with the limitation in its note.
- **Extensions** - file-name hints, used when the content alone does not decide.

## Log formats

Application, web server, database, container and system logs.

| Format | ID | Extensions | Multi-line | Fields | Field search | Field alerts | Status |
|---|---|---|---|---|---|---|---|
| IIS W3C Extended Log | `iis` |  |  | yes | yes | yes | implemented |
| PostgreSQL CSV log | `pgcsv` | `.csv` |  | yes | yes | yes | partial |
| logfmt / key=value | `logfmt` |  |  | yes | yes | yes | implemented |
| Syslog (RFC 3164) | `syslog3164` |  |  | yes | yes | yes | implemented |
| Syslog (RFC 5424) | `syslog5424` |  |  | yes | yes | yes | implemented |
| Apache Common Log | `apache-common` |  |  | yes | yes | yes | implemented |
| Apache Combined Log | `apache-combined` |  |  | yes | yes | yes | implemented |
| Nginx access (combined) | `nginx` |  |  | yes | yes | yes | implemented |
| MySQL General Query Log | `mysql-general` |  |  | yes | yes | yes | partial |
| Kubernetes CRI | `cri` |  | yes | yes | yes | yes | implemented |
| Docker json-file | `docker` |  |  | yes | yes | yes | implemented |
| Serilog CLEF (JSONL) | `clef` | `.clef` |  | yes | yes | yes | implemented |
| PostgreSQL JSON log | `pgjson` | `.json` |  | yes | yes | yes | implemented |
| Application log + stack traces | `applog` |  | yes | yes | yes | yes | implemented |
| MySQL Slow Query Log | `mysql-slow` |  | yes | yes | yes | yes | implemented |
| Qlik Script Trace | `qlik-script-trace` |  | yes | yes | yes | yes | implemented |

- **IIS W3C Extended Log** - space; no header line. Field names from the #Fields directive in the head of the file (the IIS default layout when it has none); date + time form the UTC timestamp
- **PostgreSQL CSV log** - comma, quoted with "; no header line. Multi-line quoted messages are not joined
- **Nginx access (combined)** - Default 'combined' log_format; custom log_format via Custom Pattern
- **MySQL General Query Log** - Statements spanning lines are not joined
- **Kubernetes CRI** - Partial (P) records are assembled into logical records in the inspector (bounded)
- **Application log + stack traces** - .NET / Java / Python stack traces grouped with their log line (heuristic)
- **Qlik Script Trace** - The reload / script trace: a standalone HH:mm:ss line and the lines after it form one time block; loads, Lines fetched and control-statement script errors are recognized

## Structured data

One JSON object per line, and documents TKTail highlights.

| Format | ID | Extensions | Multi-line | Fields | Field search | Field alerts | Status |
|---|---|---|---|---|---|---|---|
| JSON | `json` | `.json` |  | yes |  |  | partial |
| JSON Lines / NDJSON | `jsonl` | `.jsonl`, `.ndjson` |  | yes | yes | yes | implemented |
| XML | `xml` | `.xml`, `.xsd`, `.xsl`, `.xslt`, `.config`, `.csproj`, `.props`, `.targets`, `.svg` |  |  |  |  | partial |
| HTML (source) | `html` | `.html`, `.htm`, `.xhtml` |  |  |  |  | partial |
| YAML (limited) | `yaml` | `.yaml`, `.yml` |  |  |  |  | partial |

- **JSON** - Inspector/pretty work on the selected line or selection; multi-line documents are highlighted, not parsed whole
- **XML** - Highlighting and tag matching; no element inspector yet
- **HTML (source)** - Source highlighting only; never rendered or executed
- **YAML (limited)** - Keys/scalars/comments highlighting only; no YAML structure parser

## Delimited text

Columns separated by a character; the first line may name them.

| Format | ID | Extensions | Multi-line | Fields | Field search | Field alerts | Status |
|---|---|---|---|---|---|---|---|
| CSV (comma) | `csv` | `.csv` |  | yes | yes | yes | partial |
| CSV (semicolon) | `csv-semicolon` | `.csv` |  | yes | yes | yes | partial |
| TSV (tab) | `tsv` | `.tsv`, `.tab` |  | yes | yes | yes | implemented |
| Delimited (pipe) | `delimited-pipe` | `.psv` |  | yes | yes | yes | partial |

- **CSV (comma)** - comma, quoted with "; header line detected. Quoted fields containing line breaks are not joined into one record
- **CSV (semicolon)** - semicolon, quoted with "; header line detected. European / Qlik exports (decimal commas stay in their values); quoted fields containing line breaks are not joined into one record
- **TSV (tab)** - tab; header line detected. No quoting: a tab always separates fields
- **Delimited (pipe)** - pipe, quoted with "; header line detected. Quoted fields containing line breaks are not joined into one record

## Security events

Event formats of security products.

| Format | ID | Extensions | Multi-line | Fields | Field search | Field alerts | Status |
|---|---|---|---|---|---|---|---|
| CEF (ArcSight) | `cef` |  |  | yes | yes | yes | implemented |
| LEEF (QRadar) | `leef` |  |  | yes | yes | yes | implemented |

## Protocols and messages

Messages made of segments and fields.

| Format | ID | Extensions | Multi-line | Fields | Field search | Field alerts | Status |
|---|---|---|---|---|---|---|---|
| HTTP transcript | `http` | `.http` | yes | yes | yes | yes | partial |
| FIX | `fix` | `.fix` |  | yes | yes | yes | implemented |
| HL7 v2 | `hl7` | `.hl7` | yes | yes | yes | yes | implemented |
| ANSI X12 | `x12` | `.x12`, `.edi`, `.837`, `.835`, `.850` |  | yes | yes | yes | partial |
| UN/EDIFACT | `edifact` | `.edi`, `.edifact` |  | yes | yes | yes | partial |

- **HTTP transcript** - Request/status line + headers; body is a raw range
- **FIX** - Small built-in tag dictionary; unknown tags shown by number
- **HL7 v2** - Segments/fields/components; no message-type dictionaries or validation
- **ANSI X12** - Segments/elements/components; envelope hierarchy and dictionaries not yet
- **UN/EDIFACT** - Segments/elements/components with UNA separators; no directories

## Configuration files

Keys and values.

| Format | ID | Extensions | Multi-line | Fields | Field search | Field alerts | Status |
|---|---|---|---|---|---|---|---|
| INI | `ini` | `.ini`, `.cfg`, `.inf` |  | yes | yes |  | implemented |
| Java properties | `properties` | `.properties` |  | yes | yes |  | partial |
| .env | `env` | `.env` |  | yes | yes |  | implemented |

- **Java properties** - Backslash line continuations are not joined

## General

Text without a structure TKTail knows.

| Format | ID | Extensions | Multi-line | Fields | Field search | Field alerts | Status |
|---|---|---|---|---|---|---|---|
| Plain Text | `text` | `.txt`, `.log` |  |  |  |  | implemented |

## Configurable in the settings file

Generic parsers you configure yourself - for a shareable definition with an editor, use [your own log format](https://tktail.dev/help/custom-formats/).

| Format | ID | Extensions | Multi-line | Fields | Field search | Field alerts | Status |
|---|---|---|---|---|---|---|---|
| Custom Delimited | `delimited` |  |  | yes | yes | yes | partial |
| Custom Pattern (regex) | `pattern` |  |  | yes | yes | yes | partial |

- **Custom Delimited** - Delimiter/header configured in the settings file (no editor UI yet)
- **Custom Pattern (regex)** - Regex with (?&lt;name&gt;...) groups from the settings file; no editor UI yet

---

Source: https://tktail.dev/help/local-configuration/

# Folder formats: local configuration (.tktail)

Tell TKTail once that "the logs in this folder are Qlik traces" (or JSON Lines, or your own
custom format), and every file in that folder and its subfolders opens that way. The setting
lives in a small file named `.tktail` next to the logs - like `.editorconfig`, but for how
TKTail reads log files. A closer `.tktail` wins over one further up, and a format you pick with
**View As** always wins for the current session.

## Quick start

1. Open a log from the folder.
2. **View > View As > Set Format for This Folder...** (the same menu opens from the **Format**
   button in the RECORD view's header), pick the format, **Save**. The dialog says which file it
   writes.

3. TKTail writes `.tktail` in the file's folder. The file - and every file opened later in that
   folder or below it - uses that format. The Inspector's **Resolution** row says
   *Folder configuration*, **Configuration** names the `.tktail`, and **Auto detector** shows
   what the content alone says. The RECORD view's Format button reads `Auto (<format>)`; its
   tooltip names the `.tktail` too.

TKTail never creates a `.tktail` on its own: opening a file, browsing a folder or detecting a
format reads `.tktail` files but writes nothing. Only the actions below write one.

## What the file looks like

A Qlik folder (`root: true` - nothing above this folder applies):

```json
{
  "schemaVersion": 1,
  "root": true,
  "defaults": {
    "format": "builtin:qlik-script-trace"
  }
}
```

A mixed folder:

```json
{
  "schemaVersion": 1,
  "defaults": {
    "format": "builtin:applog"
  },
  "rules": [
    { "match": "*.jsonl", "format": "builtin:jsonl" },
    { "match": "reload-*.log", "format": "builtin:qlik-script-trace" }
  ]
}
```

| Setting | Meaning |
|---|---|
| `schemaVersion` | `1`. A file from a newer TKTail is ignored (and reported), never guessed at |
| `root` | `true`: `.tktail` files in the folders above do not apply here (a project or repository root). Optional |
| `defaults.format` | The format for every file in this folder and below, unless a rule or a closer `.tktail` says otherwise. Optional |
| `rules` | `match` (a file name or a pattern) and `format`, in order. Optional |

The file is UTF-8 JSON, at most 256 KB and 1,000 rules. Settings this version does not know are
kept when TKTail edits the file, and listed as warnings.

## Format ids

A `.tktail` names formats by a stable id, never by the name shown in the menus (names may
change; ids do not):

| Id | Format |
|---|---|
| `builtin:text` | Plain Text |
| `builtin:applog` | Application log + stack traces |
| `builtin:jsonl` | JSON Lines / NDJSON |
| `builtin:qlik-script-trace` | Qlik Script Trace |
| `builtin:<key>` | any built-in format: the keys are in `tktail formats list` |
| `custom:<id>` | a custom format profile by its id (`custom:rest.api`) - renaming the profile keeps it working |

## Rules and patterns

Patterns are relative to the folder of the `.tktail` and ignore letter case:

| Pattern | Matches |
|---|---|
| `reload.log` | a file with this name, in this folder or any folder below |
| `*.log`, `qlik-*.log`, `trace-??.txt` | file names; `*` is any text, `?` one character |
| `archive/*.log` | `.log` files directly in `archive` (below the `.tktail` folder) |
| `archive/**/*.log` | `.log` files in `archive` and any folder below it |

`\` works like `/`. Absolute paths and `..` are not allowed: a `.tktail` only describes files
below its own folder. **When several rules in one file match, the last one wins** - put general
rules first and exceptions after them.

## Folders and subfolders

```
C:\Logs\.tktail                default: Application log
C:\Logs\Qlik\.tktail           default: Qlik Script Trace; rule raw.log -> Plain Text
C:\Logs\Qlik\reload.log        -> Qlik Script Trace   (Folder configuration)
C:\Logs\Qlik\raw.log           -> Plain Text          (File rule)
C:\Logs\Qlik\2026\old.log      -> Qlik Script Trace   (Inherited configuration)
C:\Logs\api.log                -> Application log     (Folder configuration)
```

- A `.tktail` changes only what it says. A child folder whose `.tktail` has a single rule still
  inherits its parent's default for every other file.
- **Set Format for This Folder** in a subfolder writes that subfolder's own `.tktail` - the
  parent's file is not touched.
- `"root": true` stops the search upwards.
- Network shares (`\\server\share\...`) work the same way; the search stops at the share.

## The order TKTail follows

For every file, the first of these that applies decides:

1. A format you chose with **View As** in this session (or `tktail open --format`).
2. The nearest `.tktail`: its last rule that matches the file.
3. The nearest `.tktail`: its folder default.
4. The `.tktail` files further up, nearest first, until one with `"root": true`.
5. A custom format profile that names files like this one (its extensions / file names).
6. Content detection.
7. File-name hints.
8. For the new file of a [rotating dated log](https://tktail.dev/help/rotating-dated-logs/) whose content says nothing yet (it is often
   empty when it becomes LIVE): the format its previous file was read with - until its own content decides.
9. Plain Text.

A configured format that is not available - a custom profile that is not installed or is
disabled - is reported (Problems, Inspector) and the next step decides.

## Doing it from TKTail

**View > View As** (also from the Inspector's Format row and the status bar's format):

| Item | What it does |
|---|---|
| **Auto (Effective Configuration)** | Drops a View As choice: the order above decides again |
| **Set Format for This File...** | Adds a rule for this file's name to its folder's `.tktail` (an earlier rule for the same name is replaced) |
| **Set Format for This Folder...** | Sets (or removes) the folder default in this file's folder |
| **Add Local Format Rule...** | A pattern and a format; the dialog lists the files of the folder the pattern matches |
| **Edit Local Configuration...** | The folder default, the rules (add, edit, remove, reorder) and *Root configuration*, for the `.tktail` that decides the current file (or the file's folder) |
| **Explain Format Resolution...** | Every step of the order above for this file - what each `.tktail` says, what was used, what the content detector says |
| **Detect from Content...** | What the content alone says (View As and `.tktail` ignored), with *View As* that format for this session |

- Writes are safe: TKTail writes a temporary file and replaces `.tktail` in one step, keeps
  settings it does not know, and never overwrites a `.tktail` it cannot read (fix or delete
  that one first).
- Set Format for This File / Folder also drops a View As choice of the current file, so you see
  the saved format at once.
- The log files themselves are never changed.

When a `.tktail` changes - from TKTail, an editor or `git pull` - open files follow within about
two seconds. A file you chose a format for with **View As** keeps it; its Inspector notes that
the configuration changed.

## Custom formats

A custom profile is chosen in the same dialogs (they list the profiles in force), or from the
Custom Format Studio: **Use For > Apply to Current File / Set as Folder Default / Add Folder
Rule...** for the saved profile. The `.tktail` stores its id (`custom:rest.api`). Renaming the profile keeps the association; a
`.tktail` that names a profile this computer does not have falls back to the next step and says
so.

## Seeing why

- **Inspector > TKTail**: *Format* (configured / detected / chosen), *Resolution* (the source),
  *Configuration* and *Rule* (when a `.tktail` decided), *Auto detector* (what the content
  says - "differs" when it disagrees). Click *Resolution* for the full explanation, click
  *Configuration* to edit it.
- `tktail formats resolve <file>` prints the same explanation; `tktail formats detect <file>`
  shows content detection only.
- `tktail config validate <folder or file>` checks a `.tktail`.

## When something is wrong

- **A `.tktail` with a mistake** (not JSON, a format id that does not exist, `..` in a pattern)
  is ignored as a whole; the folders above and detection decide. *Problems* shows
  *Local configuration ignored - ...*; `tktail config validate` says what is wrong.
- **The wrong format** for one file: **View As > Plain Text** always shows the raw file. Then
  **Explain Format Resolution** tells which `.tktail` and rule chose it.
- **Safe mode** (`--safe-mode`) does not read `.tktail` files.

## Security

A `.tktail` only describes data: format ids and file name patterns. It cannot run anything - no
commands, scripts, programs or libraries, no includes and nothing fetched from a network - so a
repository can carry one safely. TKTail reads it with a size limit and treats anything it does
not understand as an error or a kept-but-unused setting.

---

Source: https://tktail.dev/help/custom-formats/

# Your own log formats (Custom Format Studio)

TKTail knows 35+ formats ([Built-in formats](https://tktail.dev/help/built-in-formats/) lists every one). When yours
is not one of them - a proprietary application log, an in-house service, a device - you can
teach TKTail the format yourself, without programming.
A **custom format** (a *profile*) describes it, and TKTail then treats it like a built-in
format:
- it detects files in it automatically;
- it splits records into fields with meanings (time, severity, component, message ...);
- the RECORD view shows a Summary and the Fields; the Inspector shows the current record;
- structured search and alert conditions (`level = ERROR`, `payment = 9921`) work on its
  fields;
- the viewer colours timestamps, levels and numbers.

The **Custom Format Studio** edits a profile with a live preview of every change.

**A profile is data, never code.**
- It holds patterns (regular expressions), field names, meanings and simple conditions such as
  `level = ERROR`.
- Nothing in a profile can run PowerShell, a shell command, JavaScript, a DLL or any other
  program.
- An imported profile is checked before it can be used.

The reference of every setting is CUSTOM_FORMATS.md.

## Opening the Studio

- **View > View As > Create Format for This Log...** - a new profile with up to 50 records of the
  current log (from the record you are on, at most 16,000 characters) as its sample; for a log whose
  records already span several lines the template proposed is the multi-line one, for a CSV / TSV /
  pipe file the delimited one - already set to the file's separator, with one field per column
  ([Delimited files](https://tktail.dev/help/custom-formats/#delimited-files)).
- **Tools > Custom Format Studio...**. (**Use For > Favorite Format** there lists a saved profile among
  your favorite formats - first in View As.) It opens the profile of the active file, if the file uses
  one; otherwise it starts a new profile.
- **View > View As > Custom** (also in the viewer's context menu):
  - **New Custom Format...** offers four templates:
    - *Line-based*: one record per line - timestamp, level, message.
    - *Multi-line records*: a record starts at a line with a date; the lines after it belong to
      it.
    - *Clone built-in: Application log*: TKTail's application-log format as an editable
      profile.
    - *Delimited columns*: CSV, TSV, `;` or `|` separated files - one record per line, fields read
      columns.
  - **Edit This Custom Format...** edits the profile of the active file.
  - **Clone Built-In: Application Log...** starts from the application-log clone at once.
  - A new profile - from a template, the clone or **Save as Copy** - has **no detection rules**:
    it is used where you choose it (the list below, **Use For**, a `.tktail`) and never takes
    over other logs by itself. Add *Extensions*, *File names* or a *Content pattern* under
    *Detection* when files should pick it automatically ([below](https://tktail.dev/help/custom-formats/#which-files-use-a-profile)).
  - The list in this submenu also chooses a profile by hand for the active file.
  - **Reload Custom Formats** reads the profiles again; **Open Custom Formats Folder** opens
    where they are stored.

A new profile's id and name come from the active file's name, for example `billing` and
*billing format*. Without an open file they are `my-format`.

## How a profile reads a record

Every record goes through the same steps, in the Studio's preview and in the viewer alike:

1. **Framing** - one line is one record, or a record starts at a line matching *Record start*
   and the following lines (a stack trace, a payload) belong to it until the next record start
   ([Multi-line records](https://tktail.dev/help/custom-formats/#multi-line-records)).
2. **Common pattern** - one regular expression with named groups reads the parts every record
   has (`(?<timestamp>...)`, `(?<level>...)`, `(?<message>...)`). It is matched against the
   record's first line.
3. **Record type** - optional kinds of records (*Payment failed*, *Retry* ...), tried in order
   of priority; the first that matches wins; a **fallback** type takes everything else.
4. **Type-specific extraction** - a record type can read more fields from a field (for example
   `message`) or from the whole record.
5. **Conditions** - a field can exist only when a condition is true (`level = ERROR`).
6. **Semantic roles** - each field can say what it means: timestamp, severity, message ...
7. **Presentation** - which fields the RECORD view's Summary shows, and how.
8. **Highlighting** - the viewer colours fields by their role and type: severities by level,
   timestamps, numbers.

## The Studio window

- **DEFINITION** (left) - the parts of the profile as a tree: *General*, *Detection*,
  *Framing*, *Common pattern*, *Common fields*, *Record types* (each with its own fields),
  *Semantics (severity names)*, *Summary*, *Sample*. Select one to edit it below the tree.
  - **Add Field** adds a field to the selected record type, or to the common fields.
  - **Add Record Type** adds a type before the fallback.
  - **Clone Type** copies the selected type.
  - **Remove** deletes the selected field or type.
- **PIPELINE** - what happened to the sample, step by step: was it detected, how it is framed
  into records, did the common pattern match, which record type was chosen (and which others
  matched too, or the fallback), which fields were extracted, omitted by a condition or kept raw.
  For multi-line framing it ends with every record of the sample and its source lines
  (*Record 1 - lines 1-4*). Clicking a step selects the part of the definition it is about.
- **SOURCE** - the sample, coloured by what each field captured. Clicking text selects the
  field it belongs to.
- **RECORD** - **Summary** shows the record exactly as the RECORD view will show it; **Fields**
  lists every field with its value, where it comes from (common or the record type), its role,
  type and state.
- **DIAGNOSTICS** - every mistake and warning. Clicking one goes to the part it is about.
- The status line says how long the preview took, and whether the draft is saved.

**Live preview.** The Studio uses TKTail's real parser, the same code the viewer uses - there is
no separate "preview parser". Each change is applied to the sample about 200 ms after you stop
typing, in the background; the window never freezes.

A pattern row tells you at once whether the pattern is valid and which groups it captures
(*valid - 4 groups: timestamp, level, component, message*), or what is wrong and where. A
condition row says whether it is valid and, when it is, whether it is true for the sample.

## Draft and saved profile

**You always edit a draft. Files open in TKTail keep using the saved profile until you click
Save.** A half-typed pattern can therefore never disturb monitoring or alerts.

- **Save** checks the draft. If it has errors, nothing is saved - the status line says how many,
  DIAGNOSTICS lists them, and the saved version stays in use.
- A valid draft is written safely: a temporary file, then a rename, so it is never half
  written. Open files using the profile switch to the new version at once (*Saved - applied to
  N open files*).
- **Revert** goes back to the saved version (the samples stay as they are).
- **Use For** (a saved profile without unsaved changes) makes files use it without detection:
  **Apply to Current File**, **Set as Folder Default** (the current file's folder and its
  subfolders) or **Add Folder Rule...** (a pattern such as `*.txt`). These write a
  [folder format file](https://tktail.dev/help/local-configuration/) (`.tktail`) beside the logs that names the profile
  by its id (`custom:<id>`), so renaming the profile later keeps them working. Nothing is stored
  anywhere else.
- Closing the Studio with unsaved changes asks **Save** / **Discard** / Cancel. Exiting TKTail
  counts an unsaved draft in its exit question.

## Walkthrough: a `timestamp | level | component | message` log

The log (synthetic, `billing-2026-10-05.log`):

```
2026-10-05 09:15:02.114 | INFO  | Billing.Invoices | Invoice 4711 created for account 8812
2026-10-05 09:15:02.381 | WARN  | Billing.Payments | Retry 2 for payment 9921 after 1500 ms
2026-10-05 09:15:03.007 | ERROR | Billing.Payments | Payment 9921 failed: card declined
2026-10-05 09:15:03.250 | INFO  | Billing.Invoices | Invoice 4712 created for account 8813
```

1. **Open the file** in TKTail, then **View > View As > Custom > New Custom Format...** and
   choose **Line-based**. If the sample is empty, click **Use Current Line**. The PIPELINE says
   the common pattern does not match - the template expects `timestamp level message`, not
   pipes.
2. **Common pattern**: replace it with
   `^(?<timestamp>\d{4}-\d{2}-\d{2} [\d:.]+) \| (?<level>[A-Z]+) *\| (?<component>[^|]+?) \| (?<message>.*)$`.
   The row says *valid - 4 groups*, and SOURCE colours the four parts.
3. **Common fields**: the template has `timestamp`, `level` and `message`. Select *Common
   fields* and **Add Field**; set its id and capture group to `component` and its role to
   *logger*. RECORD > Summary now shows *INFO · Invoices* with the message.
4. **Record types**:
   - **Add Record Type** `PAYMENT_FAILED`, priority 100:
     - *Match in* `message`, *Match pattern* `^Payment \d+ failed`;
     - *Extract from* `message`, *Extract pattern*
       `^Payment (?<payment>\d+) failed: (?<reason>.*)$`;
     - add its fields `payment` (type integer, role correlation) and `reason`.
   - Add `RETRY` (priority 90) the same way:
     - match `^Retry `;
     - extract `^Retry (?<attempt>\d+) for payment (?<payment>\d+) after (?<delay>\d+) ms`;
     - `delay` has type *durationMs* and role *duration*.
   - Add a type `RECORD` with **Fallback** for everything else.
5. **Summary**:
   - *Status badge* `level`, *Title fields* `component`, *Message* `message`;
   - *Primary fields* `payment, reason, attempt, delay`; *Details* `timestamp`.

   For the retry line, the Summary shows the *WARN* badge, the title *Billing.Payments*, the
   message, and the rows *Payment 9921*, *Attempt 2* and *Delay 1.50 s (1500)*.
6. **Detection**:
   - *File names* `billing*.log`;
   - *Content pattern* `^\d{4}-\d{2}-\d{2} [\d:.]+ \| `;
   - *Matching lines* `2`.
7. **Samples**: in *Sample*, **Add Line** for each kind of record and set its *Expected type*.
   **Test All** reports *4 samples · 4 detected · 4 classified correctly · 0 fallback · 0 parse
   errors*, PASS for each.
8. **Save**. The open file switches to the profile at once; the status bar shows *Billing
   service log*, and `level = ERROR` or `payment = 9921` work in search and alert conditions.

The resulting profile (`billing.tktformat.json`) - it passes `tktail formats custom validate`:

```json
{
  "schemaVersion": 1,
  "id": "billing",
  "name": "Billing service log",
  "description": "timestamp | level | component | message",
  "fileMatch": { "names": ["billing*.log"], "content": "^\\d{4}-\\d{2}-\\d{2} [\\d:.]+ \\| ", "minLines": 2 },
  "framing": { "kind": "line" },
  "envelope": { "pattern": "^(?<timestamp>\\d{4}-\\d{2}-\\d{2} [\\d:.]+) \\| (?<level>[A-Z]+) *\\| (?<component>[^|]+?) \\| (?<message>.*)$" },
  "fields": [
    { "id": "timestamp", "group": "timestamp", "type": "timestamp", "role": "timestamp" },
    { "id": "level", "group": "level", "role": "severity" },
    { "id": "component", "group": "component", "role": "logger" },
    { "id": "message", "group": "message", "role": "message" }
  ],
  "recordTypes": [
    { "id": "PAYMENT_FAILED", "name": "Payment failed", "priority": 100,
      "match": { "field": "message", "pattern": "^Payment \\d+ failed" },
      "extract": { "field": "message", "pattern": "^Payment (?<payment>\\d+) failed: (?<reason>.*)$" },
      "fields": [ { "id": "payment", "group": "payment", "type": "integer", "role": "correlation" },
                  { "id": "reason", "group": "reason" } ] },
    { "id": "RETRY", "name": "Retry", "priority": 90,
      "match": { "field": "message", "pattern": "^Retry " },
      "extract": { "field": "message", "pattern": "^Retry (?<attempt>\\d+) for payment (?<payment>\\d+) after (?<delay>\\d+) ms" },
      "fields": [ { "id": "attempt", "group": "attempt", "type": "integer" },
                  { "id": "payment", "group": "payment", "type": "integer", "role": "correlation" },
                  { "id": "delay", "group": "delay", "type": "durationMs", "role": "duration" } ] },
    { "id": "RECORD", "name": "Log record", "fallback": true }
  ],
  "presentation": { "summary": { "status": "level", "title": ["component"], "headline": "message",
                                 "rows": ["payment", "reason", "attempt", "delay"], "secondary": ["timestamp"] } }
}
```

## Multi-line records

In many logs one entry spans several lines: an error with its exception and stack trace, a
request with a JSON payload. TKTail calls each physical line a **source line** and each log entry
a **record**. Framing decides which source lines form one record. The Inspector, the RECORD view
and *Copy Current Record* then work on the whole record, whichever of its lines the caret is on.

**Framing** in the DEFINITION tree has these settings:

| Setting | Meaning |
|---|---|
| **Records** - *One line = one record* | Every line is its own record. |
| **Records** - *Multi-line: a new record at each record start* | A line matching **Record start** begins a new record. Every line after it belongs to that record until the next record start: exceptions, stack frames, payloads, text. |
| **Record start** | A regular expression for the first line of a record. Make it strict: a timestamp *and* a level, not just "a line with a date", so that text inside a payload does not start a record. |
| **Continuation** (optional) | When set, only lines matching it continue a record. A line that matches neither pattern becomes a record of its own. Leave it empty in most cases. |
| **Max lines**, **Max bytes** | Safety limits for one record. A longer run is split there; no line is lost. The viewer never joins more than 2,000 lines / 4 MB, whatever the profile says. |

### Example: an error with a stack trace

The log:

```
2026-10-05 07:15:11 ERROR MyService Request failed
System.Exception: Something happened
   at MyService.Work()
   at MyService.Run()
2026-10-05 07:15:12 INFO MyService Request completed
```

1. **View > View As > Custom > New Custom Format...**, template *Multi-line records*.
2. Select **Framing**. *Records* is already *Multi-line: a new record at each record start*.
3. Set **Record start** to a line that begins with a date, a time and a level:
   ```
   ^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} (TRACE|DEBUG|INFO|WARN|ERROR|FATAL)
   ```
   (with the space at the end). The row under it says *valid - 1 group*.
4. Paste the log as the sample (**Paste Sample**). PIPELINE shows how it is framed:
   ```
   ✓ Framing      2 records: lines 1-4, line 5
     ...
   → Record 1     lines 1-4 · 4 source lines · previewed
          1  2026-10-05 07:15:11 ERROR MyService Request failed
          2  System.Exception: Something happened
          3     at MyService.Work()
          4     at MyService.Run()
   → Record 2     line 5 · 1 source line
          5  2026-10-05 07:15:12 INFO MyService Request completed
   ```
   The first record is the one previewed in SOURCE and RECORD; the steps between *Framing* and
   *Record 1* (common pattern, record type, fields, Summary) are about it.
5. Select **Sample** and set **Expected records** to `2`. **Test All** now fails if a change
   to the profile frames the sample differently, for example *expected 2 records, got 5*.

The same profile in the viewer: with the caret on `at MyService.Work()`, the Inspector and the
RECORD view show the 4-line ERROR record, and *Copy Current Record* copies those four lines.

### What PIPELINE warns about

| Message | What it means |
|---|---|
| *no line matches the record start - the whole sample would be one record* | The Record start pattern matches nothing; every line would join one record. |
| *the first line is a continuation - in a file it would join the previous record (orphan continuation)* | The sample starts in the middle of a record (for example with a stack frame). Add the record's first line, or check the pattern. |
| *a record reaches Max lines (n) - it is split there* | A record is longer than *Max lines*; raise it if that is normal for your log. |
| *every line starts a record - is the record start pattern too broad?* | The pattern also matches stack frames or payload lines. Make it stricter (add the level). |

Search and alerts still work line by line. A search hit on a stack frame takes you to that line,
and the Inspector shows the record it belongs to. An alert fires on the line that matches.

## Delimited files

Comma-, semicolon-, TAB- and pipe-separated files open without a profile (the built-in CSV, TSV and
pipe formats). Make a profile when such a file needs names, roles, types or record types - for
example a Qlik export whose `Sales` column should be a field with its own name:

1. Open the file and choose **View > View As > Create Format for This Log...** (template *Delimited
   columns*, offered first for such a file). The draft already uses the file's separator - say
   *Semicolon (;)* - and has one field per column, named from the header line. A sample taken from the
   middle of the file (this command, **Use Current Line**, **Use Current Record**) starts with the
   file's header line, so the preview names the columns as the file does - the sample's name says
   *(with the header line)*.
2. Under **Framing**, *Records* is *Delimited*. *Delimiter* (Comma, Semicolon, Tab, Pipe), *Quote*
   (a double or single quote, or none), *Quote escape* (`""` or `\"`) and *Header line* (the first
   line names the columns) are the profile's own settings - the PREVIEW reads the sample again as
   soon as you change one, before anything is saved.
3. A field reads a column: *Capture group* `3` is the third column, `Sales` the column the header
   line names *Sales* (with *Header line* on). Changing the delimiter never requires changing the
   fields.
4. **Save**. The separator is saved in the profile (`"delimiter": ";"`), exported and imported with
   it, and used for every file the profile is chosen for.

A short line leaves its last columns out (those fields are *not captured*). A quoted value that
contains a line break is not joined into one record.

### Recipe: a profile over a detected CSV

An export TKTail already opens as **CSV (semicolon)** - `Id;Customer;Time;Amount;Level;Region;Message` - should
have its time, level and message understood: time-ordered navigation, severity colours, `severity <= error`
searches and alerts.

1. Open the file, **View > View As > Create Format for This Log...**. The draft has the file's delimiter, quote and
   header line and seven fields, one per column (`Id` ... `Message`), each reading its column by number.
2. Select the **Time** field: *Type* Timestamp, *Semantic role* Timestamp - the draft already sets both when the
   header says `Time` (or `Timestamp`, `Date`). Its *Capture group* is `3`, the third column; with a header line the
   header's name `Time` works too.
3. **Level**: *Semantic role* Severity (set from the header `Level`; rename the field if you like -
   `severity_level` - the column stays the same). **Message**: *Semantic role* Message. Other header names get no
   role: set it yourself (a column called `Sev` is your severity).
4. The PREVIEW shows each record's time, severity and message at once. **Save**.
5. Make the file use it every time: **Use For > Apply to Current File** (a `.tktail` rule beside the file), or
   under **Detection** add the file's name (`export-*.csv`) to *File names*.

After a restart the file opens in your profile (the status bar names it), records have their time and severity,
and searches such as `severity_level = ERROR` or `severity <= error` use the columns. The same steps work for comma,
TAB and pipe files, with or without a header line (without one, fields read columns by number).

## Which files use a profile

- **Detection** in a profile has *Extensions* (`.log`), *File names* (wildcards such as
  `billing*.log`), a *Content pattern* tested on the file's first lines, and *Matching lines*:
  how many of up to 64 first lines must match.
- A profile that names files (extensions or names) and matches the file - and its content
  pattern, if it has one - is a **strong** match. It wins over TKTail's built-in detection.
- A profile without file names whose content pattern matches is a **weak** match. It is used
  only when the built-in detection finds nothing.
- A profile with no detection rules is never chosen automatically - only by hand. Templates,
  the clone and **Save as Copy** make such profiles; the detection rules are yours to add.
- Name files narrowly: a profile for `.log` files whose lines start with a date would also claim
  an IIS log or any other dated log - when it wins over a confident built-in detection, the Format
  tooltip says *Content detector disagrees* and names what the content looks like.
- Among several matching profiles, the higher **priority** wins (General), then the file name.

The order TKTail follows for every file:
1. A format you chose with **View As** (or `--format`).
2. A [folder format](https://tktail.dev/help/local-configuration/) (`.tktail`) for the file or its folder - it can
   name your profile (**View As > Set Format for This File / Folder...** lists the profiles).
3. A custom profile that matches.
4. TKTail's content detection (high confidence).
5. File-name hints (low weight).
6. Plain text.

## Record types

A profile can have several record types. They are tried in descending **priority** (equal
priorities in the order listed), and the first that matches wins. At most one type is the
**fallback**, chosen when no other type matches.

A type matches in one of two ways:
- with a **pattern**, in a common field (*Match in* `message`) or in the whole record
  (`$record`);
- with a **condition** over the common fields (`level = ERROR`).

A type can extract its own fields with an **Extract pattern** from a field or the whole record.
Its fields appear only for records of that type. A type's field with the same id as a common
field must be marked **Overrides common**.

Every record gets a `recordType` field, and the Summary shows *Record type* first - so
`recordType = PAYMENT_FAILED` works in search and alert conditions. The Studio's PIPELINE also
says when several types matched one sample (*also matched: ...*), so you can fix priorities.

## Fields

What a field has today:

| Property | Meaning |
|---|---|
| Field id | the name in Fields, the Inspector, search and alert conditions (letters, digits, `_` `.` `-`) |
| Capture group | the named (or numbered) group of the pattern it reads |
| Type | text, integer, decimal, boolean, timestamp, durationMs (milliseconds, shown as *1.50 s (1500)*), enum |
| Semantic role | what the field means (below) |
| Optional | a missing capture is not a problem |
| Condition | the field exists only when this is true, for example `level = ERROR` |
| Overrides common | a record type's field replaces the common field with the same id |
| Value meanings | names for raw values: `200=OK; 404=Not found` - shown beside the value and matched by conditions |

The raw text is always kept. A value that doesn't convert (`abc` for an integer) stays as it
is, with a warning; the record is then shown as *parsed partially*.

Not available (yet): a separate display name, formatting or a presentation priority per field.
Field labels in the Summary come from the id: `elapsed_ms` reads *Elapsed ms*.

**Field states** (RECORD > Fields):
- *extracted*;
- *missing* (optional, not captured);
- *not captured* (required - a warning);
- *condition false* (omitted from the record);
- *conversion failed* (raw value kept).

**Conditions** use the same small language as structured search and alerts: `level = ERROR`,
`status >= 500`, `user.id exists`, `message contains timeout`. They compare fields - there are no
functions, expressions or scripts.

**Source ranges.** Every field keeps its exact place in the record. That is how clicking a field
in the RECORD view, the Inspector or the Studio marks its text in the source, and how the viewer
colours it.

## Semantic roles

| Role | Used for |
|---|---|
| timestamp | the Summary's *Time*, the viewer's timestamp colour |
| severity | the Summary's badge and its colour, the viewer's level colours, conditions such as `severity <= error` |
| message | the Summary's MESSAGE block |
| logger | the Summary's title (*ERROR · Payments*) and *Component* row |
| host, process, thread, user | Summary rows |
| correlation | the title (*ERROR · payment 9921*) - ties records of one operation together |
| duration | the Summary's *Duration* (durationMs values read *1.50 s (1500)*) |
| status, method, url, source, destination, stream, exception | field meanings for search, alerts and the Summary (*Status*, *Exception*) |

Roles also let search and alert conditions name a field by its meaning: `severity = error`
finds the severity field, whatever it is called in your format.

**Severity names.** *Semantics (severity names)* maps your level words to standard severities,
for example `WARN=warning; ERR=error`. The badge colour and `severity <= error` conditions then
understand them.

## The Summary

The RECORD view's Summary for a custom format:
- **Status badge** - a field (usually the level), coloured by severity.
- **Title** - the fields listed in *Title fields*, joined with " · ". Default: the severity and
  the logger's short name.
- **MESSAGE** - the field in *Message* (default: the field with the message role), as its own
  block.
- **Primary fields** - the fields listed, as rows. Default: Time, Duration, Exception, Logger,
  Thread by role.
- **Details** - further fields in a second section.
- *Record type* is always the first row.

Long messages are previewed: the Summary shows the beginning, with **Show Full Message** for
the rest. **Copy**, **Copy Message** and **Export** always use the complete value, never the
preview.

## Samples and Test All

A profile keeps **named samples**: lines or records from your logs, each with an optional file
name (for detection), an **Expected type** and, for multi-line formats, **Expected records** (how
many records the sample must frame into; empty = any).
- **Add Line** / **Add Record** take one from the log you're looking at; **Duplicate** and
  **Remove** edit the list. At most 200 samples of up to 64 Ki characters each.
- **Test All** runs every sample through the draft:
  - a summary such as *10 samples · 10 detected · 9 classified correctly · 1 fallback · 0 parse
    errors*;
  - PASS / FAIL per sample with the reason, for example *expected PAYMENT_FAILED, got
    RECORD* or *expected 2 records, got 5*.
- The toolbar's **Use Current Line / Use Current Record / Use Selection / Paste Sample / Load
  Sample...** replace the sample being previewed. *Load Sample* reads the first 20 lines of a
  file, decoded as UTF-8.

Samples are saved **on this computer** beside the profile (`<profile>.tktsamples.json`), when
you Save. They are never part of an exported definition unless you choose **Export with
Samples** - samples come from your logs and may contain customer data, account numbers or
tokens, so TKTail asks first.

## Import, export and copies

**More** in the Studio's toolbar:
- **Import Definition...**
  - Opens a `*.tktformat.json` file as a draft you can check in the preview first; nothing is
    installed until you Save.
  - A definition from a newer TKTail is refused with a clear message.
  - If its id is already installed, Save asks **Replace** or **Save as Copy**.
  - Samples inside the file are added to the sample list.
- **Export Definition...** writes the current draft (normalized) as it is - the definition only.
- **Export with Samples...** writes the draft plus its samples, after the warning above.
- **Save as Copy** saves the draft under a new id (`<id>-copy`) and name (*(copy)*), without
  the original's detection rules - two profiles claiming the same files would decide by their
  order, not by you.
- **Copy JSON** copies the draft's definition to the clipboard.

From the command line (details in [command-line.md](https://tktail.dev/help/command-line/) and
CLI.md):

```
tktail formats custom list
tktail formats custom validate billing.tktformat.json
tktail formats custom import billing.tktformat.json            # --replace / --copy when the id exists
tktail formats custom export billing billing.tktformat.json   # --force to overwrite
tktail formats custom export-all C:\Backup\Formats
tktail formats custom remove billing --yes
tktail open C:\Logs\billing-2026-10-05.log --format custom:billing
```

Profiles are files in `%LOCALAPPDATA%\TKTail\Formats` (or `data\Formats` beside TKTail.exe in
portable mode). TKTail notices changes when its window becomes active, when the View As >
Custom submenu opens, or with **Reload Custom Formats**. A profile with mistakes is never used:
it is listed as not usable and reported in the **Problems** panel. Safe mode (`--safe-mode`)
loads no profiles.

**From an AI assistant.** An assistant connected to TKTail ([mcp.md](https://tktail.dev/help/mcp/)) can write a profile
for a log - for a delimited log, starting from a draft fitted to it as above - check it and preview it with
TKTail. It gives it to you to import - or, only if you allowed **Allow AI to save custom formats** (Settings > AI
Access, or **Tools > Allow AI to Save Custom Formats**), saves it itself; such a profile is listed here like your
own (Output > Application says when one was saved), and the assistant can only replace the version it read -
never your later edits. The profile file's JSON Schema, for editors and tools that check JSON, is
tktail-format.schema.json.

## Compatibility with alert rules

- **Field schema.** *General* shows the profile's field schema as a short code, a fingerprint
  of its field ids and types (*aa7c9141 · 9 fields*), and says when it *changed since saved*.
  `tktail formats custom list --output json` lists it as `fieldSchema`, with `profileVersion`.
- **Saving a version that removes fields.** If an alert rule tests a field the new version no
  longer has, Save asks first and names the fields and the rules (**Save Anyway** / Cancel).
  After saving, those rules no longer match records of the format.
- **Application log: `component` and `message`.** TKTail's built-in application-log format
  reads the logger name after the level into its own field, `component`. An alert rule that
  tests `message` on an application log may need adjusting. The **Problems** panel says so for
  each such rule.

**Versions.**
- `schemaVersion` is the file format (1). A newer one is refused.
- *Profile version* (General) is your own revision number. Change it when you publish a new
  version; TKTail shows it in `formats custom list` and never changes it itself.

## Built-in formats as a starting point

Only TKTail's **application log** can be cloned (*Clone Built-In: Application Log*). The clone
reads:
- the classic application-log shapes - timestamp, level, an optional dotted component,
  message (the built-in format also learns other field orders from the file; the clone keeps the
  timestamp-first one - edit its envelope pattern for another order);
- records framed like the built-in format: a record starts at a line with a timestamp and a
  level; stack traces, payloads and text after it belong to it;
- an `ERROR` record type with `exception` / `exceptionMessage`.

The clone does not cover everything the built-in format does:
- The built-in **message** is the whole record body (the exception and stack frames included);
  the clone's `message` is the text on the first line - the exception is in `exception`, and the
  whole record is in Source and *Copy Current Record*.
- The bracketed variant `[timestamp] [LEVEL] [Component] [CONTEXT] message` with its `context`
  fields, levels in any letter case, and a level that does not follow the timestamp directly
  (`2026-10-05 10:00:00 [worker-1] ERROR ...`) stay built-in only. In the clone such lines do not
  start a record.

Other built-in formats (FIX, IIS ...) cannot be cloned; they are not expressible as a profile yet.
For delimited files use the **Delimited columns** template (below) - the built-in CSV, TSV and pipe
formats already open such files without a profile. **Qlik Script Trace** cannot be cloned either: its time blocks could be framed with a
record start (a line holding only a time), but counting entries, the fields of a block with one
load and recognizing script errors are built-in only.

## Current limitations

- **Delimited profiles**: a quoted value that contains a line break is not joined into one record
  (every line is a record), as in the built-in CSV formats.
- **Nested payloads.** A JSON object inside a message stays part of the message; reading it as
  its own fields is planned (FORMAT-4).
- **Settings without effect yet.** `highlighting` classes, `nested`, `rotationHints`, `encoding`
  and a record type's *Severity class* are checked and kept, but have no effect yet. Colours
  come from roles and types.
- **Multi-line records** are limited to 2,000 lines / 4 MB in the viewer, even if the profile
  allows more.
- **Not available.**
  - *Test Against Current File* (testing a whole open file);
  - samples on the command line;
  - deleting a profile from the window (use `tktail formats custom remove`).
- **Disabled profiles.** A disabled profile appears in View As > Custom as *(disabled)* but
  cannot be chosen until enabled again.
- **Keyboard.** The Studio's buttons have mnemonic letters, but the Studio has no keyboard
  shortcuts of its own.

## Troubleshooting

| Problem | What to check |
|---|---|
| The profile is not used for a file | Detection: do *Extensions* / *File names* match the file? Does the *Content pattern* match at least *Matching lines* of the first lines? A profile without file names is used only when TKTail's own detection finds nothing; a new profile (template, clone, copy) has no detection rules at all. You can always choose it in View As > Custom or with Use For. |
| A profile takes over logs it was not made for (an IIS log shows `Auto (my profile)`) | Its *Extensions* / *Content pattern* are too broad - the Format tooltip says *Content detector disagrees: ...*. Narrow its *File names*, or remove its detection rules and use **Use For** for the files it is meant for. Profiles made by TKTail before 2026-10-06 from a template or the clone carried `.log` (and `.txt`) with a leading-date pattern: check those. |
| *Not a custom format definition* / the profile is listed as not usable | Open it in the Studio (or run `tktail formats custom validate <file>`): DIAGNOSTICS lists every error with its location. |
| A pattern is invalid | The row under it says what is wrong and at which position (an unmatched `(`, an unknown group name ...). Look-behind is not supported. |
| A stack-trace line is a record of its own | The *Record start* pattern is too broad, or the profile is *One line = one record*. PIPELINE lists every record of the sample with its lines. |
| Several log entries are one record | *Record start* does not match their first lines; PIPELINE says *no line matches the record start* or shows the records it found. |
| The wrong record type is chosen | PIPELINE lists the types that matched; raise the priority of the right one or make its pattern stricter. Give samples an *Expected type* and use Test All. |
| A field is absent | RECORD > Fields shows its state: *condition false*, *missing*, *not captured* (the group did not take part in the match) or *conversion failed*. |
| The Summary is empty | Give a field the *severity* or *message* role, or set the Summary mapping. |
| A field marks the wrong text | The capture group's pattern takes more or less than you expect; SOURCE shows exactly what each group captured. |
| Save is blocked | The draft has errors (DIAGNOSTICS). The saved version stays in use until the draft is valid. |
| *Alert rules test fields this version removes* | Keep the fields (or rename them in the rules) - or Save Anyway when you mean it. |
| A pattern is slow | PIPELINE warns when one record takes more than 2 ms: a pattern may backtrack heavily. Anchor it (`^`) and avoid nested `.*`. |

---

Source: https://tktail.dev/help/alerts-and-monitoring/

# Alerts and monitoring

> **Field change (2026-10-04):** in application logs the logger name after the level is now the
> field `component`; `message` holds only the text after it. An alert that looked for a
> logger name in `message` no longer matches - TKTail lists such alerts in **Problems** when an
> application log is open or monitored. Change the condition to `component`.

TKTail can watch files for you - while you look at something else, with the window hidden in
the notification area, and also for files you have no tab open for.

## How it fits together

| | |
|---|---|
| **Condition** | what to look for: text or a regular expression, a field condition (`level = ERROR`), or one Performance Counter threshold ([Metrics](https://tktail.dev/help/metrics/), Trial / Pro) - tested on the new, complete lines of the files the alert names, written after the alert exists |
| **Alert** | the saved rule: the condition, a severity (Info, Warning, Error, Critical), how often to notify and which evidence to keep. Every change of its meaning is a new version |
| **Notification** | a Windows notification, the tray icon, a sound or TKTail brought to the front - at most one per second. The status bar and the tray say *2 new alerts · Critical*; nothing interrupts you with a dialog |
| **Incident** | one occurrence of the alert: *New* until you acknowledge it; pin the ones to keep |
| **Evidence** | kept with the incident: the trigger record and the records around it (10 before and 10 after by default; a multi-line record whole), and - when the alert asks for them - the Windows events and the metric samples of that moment. It stays when the log is rotated, truncated or deleted, and after a restart |
| **History** | **Tools > Alert History** lists the alerts that fired, **Tools > Incidents** the incidents |

Not in this version: alerts on sequences, on Windows Event Logs (an event log is evidence only), on
whole folders or on all open files; e-mail, webhook or script actions.

## Creating an alert

1. Select the text you want to be told about in a log (for example `ERROR` or an order id).
2. Choose **Tools > Add Alert...** (Ctrl+Shift+A), or right-click > **Add Alert for
   Selection...**. In the Explorer, right-click a file > **Add Alert...**.
3. In the **Alert** dialog:

| Section | Field | Meaning |
|---|---|---|
| | Name, Severity, Enabled | How the alert is called in notifications and incidents; Info / Warning / Error / Critical; an alert can be kept but switched off |
| Trigger | Text in the file: Watch for | The text to look for (filled with your selection) |
| | Regular expression / Match case | How *Watch for* is matched - the same [regular expressions](https://tktail.dev/help/search/#regular-expressions) as Find |
| | Field condition | Match a parsed field instead of text, e.g. `level = ERROR`, `sc-status >= 500`, `OrdStatus = Rejected` |
| | A performance counter | A Windows Performance Counter (**Choose...** opens the [counter picker](https://tktail.dev/help/metrics/)) over or under a threshold (`90`, `90 %`, `4 GiB`), for a number of seconds without a break (0: one sample decides) - needs the Metrics feature of your license |
| Evidence to keep | Records of the file | The logical records kept before and after the record that matched (a multi-line entry counts once) |
| | Windows events | A log (`System`, `Application`, a channel such as `Microsoft-Windows-PowerShell/Operational`, or a saved `.evtx`), its levels, minutes before and after the trigger |
| | Metrics | A Metric Set (Host Basics, ...), minutes before and after the trigger - an enabled alert keeps them collected, so their history exists when it fires |
| Behavior | Notify | *Every match*; *First match only (until re-armed)*; *At most once per interval*; *First match, then a summary per interval* |
| | Interval (s) | For the interval modes |
| | Fires again within | Matches this many seconds after the last one join the same incident instead of starting a new one (0: never) |
| Notification | Actions | Windows notification, tray icon attention, sound, bring TKTail to front |
| | Show matching text in notifications | Off: notifications then name the alert and file but not the log line (privacy) |

The line under *Evidence to keep* says what the alert will keep, in words. The pattern is checked
when you press OK; an invalid regular expression is reported and the dialog stays open. A line
that makes a pattern hit its complexity limit is skipped for that alert - the other alerts and
lines go on.

Only **new** lines are checked - lines written after the alert exists. A text alert applies to
the file it was created for (for a dated file that TKTail follows: its series); a counter alert fires
once when its condition becomes true and again only after it was false in between (a sample that could
not be read never counts either way).

## Managing alerts

**Tools > Manage Alerts...** lists your alerts with their condition, what each keeps and whether
it is evaluated - *Yes - u_ex261106.log (no tab)* names the file it reads now; *Waiting - ...* says that
its file is not there yet (TKTail opens it when it is); *No - ...* why not (a disabled alert, a condition
TKTail cannot watch live, a missing license feature). Check or uncheck an alert to enable or disable it; **Edit...** opens the Alert
dialog, **Delete...** removes it (its incidents stay), **Incidents** shows its incidents, **New
Metric Alert...** adds a counter alert. An alert created from a search (several conditions) keeps
its condition as it is; its evidence and behavior can be edited. Every saved change of what an
alert means is a new version - an incident names the version that fired.

## When an alert fires

Depending on the alert's actions you get a Windows notification (click it to jump to the
line in TKTail), the TKTail icon in the notification area changes to the alert icon, a sound
plays, or TKTail comes to the front. The notification's title names the alert's severity
("TKTail — Critical: CPU busy"). The status bar shows the number of unread alerts and the highest
severity among the new incidents (*2 new alerts · Critical*; its tooltip has the count of each
severity); the tray icon's tooltip says the same. Nothing opens or takes the focus because an alert
is Critical.

Every alert is written to the **alert history** (`alerts.jsonl` next to the settings, see
[Getting started](https://tktail.dev/help/getting-started/#where-tktail-keeps-its-data)), including the file,
position and a short preview (subject to the privacy option above). The size of the history
is limited by settings. Rotations of monitored files are recorded there too.

An alert made on a file whose name carries the date (`app_2026-10-14.log`) watches the whole
series: when `app_2026-10-15.log` is LIVE, the alert watches it, and its incidents name the file the
line was really written to - also with no tab open and after a restart
([Rotating dated log files](https://tktail.dev/help/rotating-dated-logs/#alerts-incidents-and-monitoring)).

Browse the history in the **Alerts** view of the bottom panel (**Tools > Alert History**, see
[Bottom panel](https://tktail.dev/help/bottom-panel/#alerts)): filter by rule or file, show unread only, open an
alert at its exact position in the right file, mark alerts read. **F8** / **Shift+F8** go to
the next / previous alert in the current file. `tktail alerts history` *(planned)*.

### Incidents

An alert that fires also keeps an **incident**: the record that matched and, by default, the
**10 records before and the 10 after it** in the same file - read when the alert fires and kept as
they were, so they are still there after the log was rotated, truncated or deleted. A record that
grows after the line that matched (a stack trace) is kept whole. Alerts that fire again and again
within a minute are one incident: its match count grows instead of a new copy of the evidence
being kept for each.

Investigate them in the **Incidents** view of the bottom panel (**Tools > Incidents**, see
[Bottom panel](https://tktail.dev/help/bottom-panel/#incidents)): what fired, each piece of evidence with its state -
*Complete*, or *Partial* / *Unavailable* with the reason (the file had fewer records, a counter
was collected for less time than asked, an event log no longer holds the start of the window, a
log does not exist) - and a preview of what was kept.
Acknowledging an incident marks its alert read, and marking alerts read acknowledges their
incidents. **Export** writes an incident as a folder (a README, the kept records as a `.log`,
events and samples as text and CSV, and the machine-readable files) to attach to a ticket.

Incidents are kept in the `Incidents` folder of the data folder (see
[Getting started](https://tktail.dev/help/getting-started/#where-tktail-keeps-its-data)), at most 1,000, 90 days and
512 MB (`alerts.incidentMaxCount`, `alerts.incidentMaxAgeDays`, `alerts.incidentMaxMB` in
settings.ini). They follow the alert history's privacy settings: without a
persistent history (`alerts.persist=0`) no incident is kept, and when the history keeps only the
match or no text (`alerts.preview`) an incident keeps the same and no log records.

Alerts you created with an earlier version moved to the `Alerts` folder the first time this
version started - with the same names, conditions and numbers, and the severity **Warning**
(change it in the alert editor); `settings.ini` keeps the old rules for an earlier version.
An incident keeps the severity its alert had when it fired: making an alert Critical later
does not change the incidents it already has. `tktail alerts list` lists your alerts, their conditions and what each
keeps.

## Monitoring files in the background

An enabled alert keeps its file watched while TKTail runs - with or without a tab, hidden in the
notification area too; for a dated series, its newest file. Disabling or deleting the alert ends that
watch. To keep a file watched for its own sake, with a refresh mode or a format of your choice (and
remembered in the settings):

- Explorer: right-click the file > **Monitor in Background**
  (**Stop Monitoring** reverses it), or
- command line: `tktail monitor add C:\Logs\service.log` (`monitor remove`, `monitor list`).

Closing a tab of a monitored file keeps the file monitored in the background.

A background file is watched the same way as an open one, with the same
[refresh mode](https://tktail.dev/help/large-and-network-files/#files-on-network-shares): an alert on a local file fires as the
line is written; on a network share in Auto, within about a second while the file is being
written and up to ~30 s after a long quiet spell; with Poll, within the chosen interval. To
choose the mode, open the file and change **Monitoring > Refresh** in the Inspector - it is
saved with the background source. A background file on a share that cannot be reached is
checked again with growing pauses (up to a minute) and continues when the share is back.

**Tools > Pause All Monitoring** stops all watching (no alerts) until you resume it; the tray
icon shows the paused state.

An AI assistant can set up and check alerts with you - propose the condition, check it with TKTail, save it only with
**Allow AI to manage alerts** and your yes, then report whether it is running and which file it reads
([Alerts with an assistant](https://tktail.dev/help/ai-assistance/#alerts-with-an-assistant)).

## The notification area (tray)

Alerts run only while TKTail runs. The **Hide to Notification Area** button in the title bar, right before
minimize (the arrow dropping into a tray; also **File > Hide to Notification Area**) takes the window off the desktop
with one click: monitoring, LIVE
tabs and alerts go on, nothing is reloaded, and the icon in the notification area brings the window back. The
icon shows unread alerts and its menu lists them - see
[The notification area](https://tktail.dev/help/windows-integration/#the-notification-area-tray). Exiting while alerts are enabled asks
first - *Closing TKTail stops 4 active alerts*: **Keep Running in the Notification Area** (the default),
**Close and Stop Alerts**, or **Cancel** ([Closing the window](https://tktail.dev/help/getting-started/#closing-the-window)). To start
TKTail there when you sign in: **Settings > Startup** ([Starting with Windows](https://tktail.dev/help/windows-integration/#starting-with-windows)).
Retention of the alert history and incidents: **Settings > Alerts & Incidents** ([Settings](https://tktail.dev/help/settings/#alerts--incidents)).

## What survives a restart?

| | After a restart |
|---|---|
| Your alerts | Kept - the same alerts, enabled or disabled as you left them, with their conditions, evidence and versions. Alerts made by earlier versions of TKTail (1.0.0 - 1.1.0) are read as they are and behave as before |
| Watching | Enabled alerts start watching again by themselves - a dated series on its newest file, also one that appeared while TKTail was not running |
| What was already read | Not read again: a file is watched from its end when TKTail opens it, so nothing fires twice because of a restart. Lines written while TKTail was not running are not checked |
| Incidents and the alert history | Kept, with their evidence, acknowledgements and pins, and the TKTail run that captured them |
| The workspace | Restored: tabs, splits, the active tab, positions, LIVE / PAUSED, Event Log and Metrics views, dated series ([Viewing logs](https://tktail.dev/help/viewing-logs/#when-tktail-starts-again)) |
| Settings, monitored files, Saved Searches, Metric Sets, formats | Kept |
| Evidence packages, pinned searches | Kept: packages until you delete them; up to 20 pinned searches with their results ([Saving evidence](https://tktail.dev/help/saving-evidence/)) |
| Running searches, exports and index jobs, terminal sessions, linked windows | Not resumed: they end with TKTail - run a search again (or pin it first), start a terminal again |

---

Source: https://tktail.dev/help/command-line/

# Command line

`TKTail.exe` is also a command-line tool. Everything here works from Command Prompt,
PowerShell, shortcuts and scripts. The complete reference (every command, option, value
format and exit code) is docs/CLI.md; `tktail --help` and
`tktail <command> --help` print it in the console.

> `tktail` below means `TKTail.exe` (add its folder to `PATH`, or type the full path).

## Opening files and folders

```
tktail C:\Logs\service.log                   open (same as: tktail open ...)
tktail open a.log b.log --paused              several files, start paused
tktail open C:\Logs\*.log                     wildcards in the file name
tktail open server.log --line 150000          go to a line
tktail open huge.log --offset 8GB             go to a byte position
tktail open api.log --search ERROR            open and find
tktail open api.log --search "timeout|refused" --regex
tktail open session.fix --format fix          choose the record format
tktail open app.log --split-right             open next to the current pane
tktail folder C:\Logs                         show a folder in the Explorer
tktail folder C:\Logs --search-content "OutOfMemory" --recursive
```

If TKTail is already running, the command is passed to it and the console returns at once.

## Windows Event Log

```
tktail eventlog list                          the event logs of this computer
tktail eventlog open System                   open a tab: the newest 1,000 events, then LIVE
tktail eventlog open Application --last 100 --level error,warning
tktail eventlog open System --live            only events from now on
tktail eventlog query System --last 20 --level error      print events, no window
```

More in [Windows Event Log](https://tktail.dev/help/windows-event-log/#command-line).

## Places and monitoring

```
tktail favorites add C:\Logs\Service          add / remove / list favorite folders
tktail recent files                           recently opened files (also: recent folders)
tktail monitor add C:\Logs\service.log        keep watching a file in the background
tktail monitor list
tktail alerts list                            alerts (condition, evidence, whether it is evaluated)
```

## Settings and Windows integration

```
tktail settings                               open the Settings window
tktail settings list                          all public settings, their values and when they apply
tktail settings get general.closeAction
tktail startup enable --tray                  start with Windows, hidden (or --minimized, --normal)
tktail integration status                     autostart, Explorer entries, Start menu, desktop, Send To
tktail integration open-with enable           add "Open with TKTail" to Explorer's menu of files
tktail integration explorer enable            add the TKTail submenu (files and folders)
tktail integration remove-all --yes           undo every integration
tktail portable status                        where settings are stored
```

## Controlling the running window

```
tktail app activate                           bring the window to the front
tktail app tray                               hide it in the notification area
tktail app exit                               close TKTail (monitoring stops)
tktail ui open-dialog                         show File > Open
```

## Linked windows

```
tktail --new-window                           a new, empty linked window of the running TKTail
tktail open app.log --new-window              app.log in a new linked window
```

Without a running TKTail the files open in the new main window. See [Linked windows](https://tktail.dev/help/windows/).

## AI integration (MCP)

```
TKTail.exe mcp --stdio                        the MCP server an AI client starts (not run by hand)
```

Your AI client (for example Claude Code) starts this command and talks to it; it answers from the
running TKTail window once you allow it there. See [AI integration (MCP)](https://tktail.dev/help/mcp/).

## License

```
tktail license status                         the license in effect
tktail license info                           details for support (never the code)
type license.tktlic | tktail license activate --stdin
tktail license import license.tktlic          activate the license in a file
tktail license status --license-file x.license   the license a given file gives (verified as usual)
```

The license code is never taken as an argument: other programs and your shell history could
read it there. See [License](https://tktail.dev/help/license/).

## For scripts

- **Exit codes**: 0 success, 1 no match, 2 invalid arguments, 3 file not found, 4 access
  denied, 5 operation failed, ... (full table in docs/CLI.md).
- **Machine-readable output**: `--output json`, `jsonl` or `csv` on listing commands, e.g.
  `tktail monitor list --output json`.
- **Response files**: `tktail @args.txt` reads arguments from a file (one per line).
- **No prompts**: commands that change or delete things need `--yes`; `--dry-run` shows what
  would change.
- `--quiet` prints only results and errors; `--timeout 10s` limits how long a command waits
  for the running instance.

---

Source: https://tktail.dev/help/license/

# License

TKTail shows which license is in use at all times - in the **license badge** on the right of
the toolbar, just before the search box, and in short at the end of the status bar.

| Badge | What it means |
|---|---|
| `FREE · NON-COMMERCIAL` | TKTail Free: free forever for personal, educational and other **non-commercial** use |
| `TRIAL · 18 DAYS` | A Pro trial: commercial evaluation and testing are permitted while it is valid; it turns amber in its last three days |
| `PRO PERSONAL · <name>` | A paid personal license: commercial use by the named person |
| `PRO BUSINESS · <organization>` | A paid business seat: commercial use for the organization |
| `INVALID LICENSE · FREE` | The stored license could not be verified (changed or damaged); TKTail Free applies |
| `DEVELOPER · <name>` | A Developer license, for developing and testing TKTail itself: every feature is available. It is not a paid license and is shown in the neutral text colour, never like one |

The text always names the license - the colour (amber, blue, green, red) only repeats it. In a
narrow window the badge shortens (`FREE`, `TRIAL · 18D`, `PRO PERSONAL`).

Final legal wording of the license terms is subject to the EULA; **Help > About TKTail >
View License Terms...** shows the current draft for your edition.

Some features need a Trial or Pro license - for example [linked windows](https://tktail.dev/help/windows/) and
[Metrics](https://tktail.dev/help/metrics/). Without one they stay visible, marked *(Pro)*, and explain what they need
when chosen. [AI integration (MCP)](https://tktail.dev/help/mcp/) for what is open in TKTail works in every edition, and so does following
[rotating dated log files](https://tktail.dev/help/rotating-dated-logs/) - keeping their previous files open beside the LIVE one needs a Trial or
Pro license.

The editions and what each includes: [tktail.dev/pricing](https://tktail.dev/pricing/). Buying a license and managing
a subscription happen in TKTail's account portal, linked from [tktail.dev/account](https://tktail.dev/account/) once it
is open - TKTail itself never contacts it; the license you receive works offline.

## Details

Click the badge (or **Help > License...**) for **About / License**: edition, licensed to,
e-mail, organization, usage rights, trial or update dates, license ID, the license's own
description and a summary of its terms.

Hover the badge for a short summary; right-click it for **License Details**, **Enter / Change
License Code**, **Import License File**, **Copy License Information**, **Open License
Folder**, **Reload License** and **Show License Owner in Application Chrome**.

**Copy License Information** copies what support needs (product, version, edition, license
ID, owner, usage, dates) - never the license code itself.

## Entering a license code

You receive a license code by e-mail (a long line starting with `TKT1.`) or as a license file
(`.tktlic`).

1. **Help > Enter License Code...** (or right-click the badge).
2. Paste the code into the box - line breaks added by your e-mail program do not matter - or
   click **Paste from Clipboard**, or **Import License File...**.
3. TKTail checks the code after a moment (or click **Validate**). A valid code shows its
   details - edition, your name, e-mail, organization, usage, license ID, dates, description.
   Check that it is yours.
4. Click **Activate License**. The dialog confirms *License activated successfully* and the
   badge changes at once - no restart.

- Checking a code works **offline**: the code carries a digital signature that TKTail verifies
  on your computer. Nothing is sent anywhere.
- A code that was changed, damaged, is for another product or has expired is refused with a
  short reason (*Invalid license code: ...*). **Copy Diagnostics** copies the technical
  result for support (never the code).
- Changing a license (**Change License Code...**): your current license stays active until the
  new code has been verified and saved. If anything goes wrong, nothing changes.
- The clipboard is read only when you paste or click **Paste from Clipboard**.
- If a license file beside TKTail.exe is in use (see below), activating installs the new
  license but says that the one beside TKTail.exe stays in use - it takes precedence.

## Trial and updates

- When a trial ends, TKTail continues as **TKTail Free** (non-commercial use). Your settings,
  alert rules, formats and history stay as they are; About shows when the trial ended.
- A paid license is **perpetual**. It includes updates for its update period; when that period
  ends the badge turns amber and the details say *Updates ended &lt;date&gt; - this license does not
  expire*: the versions released until then stay licensed.

## Privacy

- The e-mail address is never shown in the toolbar or the status bar - only in the tooltip and
  in About.
- Hide the owner's name (for screenshots or screen sharing): right-click the badge > **Show
  License Owner in Application Chrome**. The badge then shows only `PRO PERSONAL` /
  `PRO BUSINESS`.
- The license code is never written to TKTail's logs.

## Command line

```
tktail license status
tktail license info
type license.tktlic | tktail license activate --stdin
tktail license import license.tktlic
tktail license status --license-file test.license   (which license a file would give)
```

The code is deliberately **not** accepted as a command-line argument - other programs and your
shell history could read it there. Pipe it (`--stdin`) or import the file. See
[Command line](https://tktail.dev/help/command-line/) and docs/CLI.md.

## Where the license is kept

The license is a small file, **`TKTail.license`** - the signed code itself. Editing it makes the
license invalid. TKTail looks for it in this order and uses the first valid one:

1. a file given with **`--license-file <path>`** when TKTail is started (for testing an edition:
   only that file counts);
2. **`TKTail.license` beside `TKTail.exe`** - e.g. a portable copy or a test installation that
   should have its own license;
3. **`TKTail.license` in your TKTail data folder** - `%LOCALAPPDATA%\TKTail\`, the folder you chose
   in Settings > Files & Storage, or in portable mode `data\` beside TKTail.exe
   ([Where TKTail stores data](https://tktail.dev/help/data-and-privacy/)). This is where **Enter License Code** and **Import
   License File** put it.

**Help > License...** shows which file is in use (*Source*), a file that was not valid and why
(*Ignored*), and an installed license that is not in use because another one takes precedence.
**Help > Open License Folder** shows the license file in File Explorer; **Help > Reload
License** reads the files again (TKTail also notices a changed file when you switch back to it).

Moving to another computer: copy `TKTail.license` there and import it (Help > Import License
File...) or place it in one of the folders above - it is verified again there. TKTail keeps no
license data in the Registry.

---

Source: https://tktail.dev/help/data-and-privacy/

# Where TKTail stores data, privacy and cleanup

TKTail keeps everything on this computer. It contacts nothing over the network, has no telemetry and no cloud
sync, and its license works offline; it answers AI clients over HTTP only if you turn that on
([AI integration](https://tktail.dev/help/mcp/#connect-over-http)). **Settings > Files & Storage** shows every location below with **Open**
and **Copy**.

## The data folder

| | Where |
|---|---|
| Normally | `%LOCALAPPDATA%\TKTail` - per Windows user (for example `C:\Users\<you>\AppData\Local\TKTail`) |
| A folder you chose | **Settings > Files & Storage > Change Data Folder...** - from the next start |
| Portable | `data` beside `TKTail.exe`, when a file named `TKTail.portable` is there (or with `--portable`) |

`tktail portable status` prints which one is in use.

**Changing the data folder** - choose a folder on a local disk (not a network share); TKTail checks that it can
write there and asks before it changes anything. The new folder is used **from the next start**; TKTail moves
and deletes nothing. Your settings, workspace, alerts, incidents, custom formats, Saved Searches, Metric Sets
and logs stay in the old folder: to take them along, exit TKTail and copy the old folder's contents into the new
one. **Use the Default Data Folder** goes back the same way. If the chosen folder cannot be used at a start
(a removed drive), TKTail uses the default folder for that run and says why in the status bar and in Problems -
the data in the chosen folder stays where it is. (The choice itself is the one line in
`%LOCALAPPDATA%\TKTail\data-folder.txt`.)

## What is in it

**Your data** - kept until you change or delete it:

| File or folder | Contents |
|---|---|
| `settings.ini` | Settings ([Settings](https://tktail.dev/help/settings/)) |
| `workspace.json` | The main window's tabs and splits, reopened at start ([When TKTail starts again](https://tktail.dev/help/viewing-logs/#when-tktail-starts-again)) |
| `recent.txt` | Recent files and folders (paths and times only) |
| `Alerts\` | Your alerts, one file each |
| `alerts.jsonl` | The alert history (limited by Settings > Alerts & Incidents) |
| `Incidents\` | Alert incidents and their evidence: the records, events and metric samples an alert kept (limited by count, age and size; pinned ones stay) |
| `Evidence\` | Evidence packages ([Saving evidence](https://tktail.dev/help/saving-evidence/)): `packages\*.zip` with their `.sha256`, the library's `catalog.jsonl` - kept until you delete them (bounded by Settings > Alerts & Incidents > Evidence packages) |
| `Pinned Searches\` | Your pinned searches, kept across restarts: each search and where its results are - not the logs' text |
| `redaction-rules.json` | Your own redaction rules for evidence packages (optional; you write it - [Saving evidence](https://tktail.dev/help/saving-evidence/#redaction)) |
| `Formats\` | Your custom format profiles ([Custom formats](https://tktail.dev/help/custom-formats/)) |
| `Searches\` | Saved Searches |
| `metric-sets.json` | Your Metric Sets |
| `logs\` | TKTail's own application log (rotated: Settings > Logging) |
| `TKTail.license` | Your license, when you entered it in TKTail ([License](https://tktail.dev/help/license/#where-the-license-is-kept)) |
| `mcp-http.token` | The token AI clients use over HTTP, encrypted for your Windows user ([AI integration](https://tktail.dev/help/mcp/#connect-over-http)); made the first time HTTP is used |
| `node.id` | This TKTail's random node ID, which AI clients see in every answer ([Which TKTail answered](https://tktail.dev/help/mcp/#which-tktail-answered)); made once, never derived from your computer |

**Temporary files** TKTail makes and removes again:

| What | Where | Removed |
|---|---|---|
| Evidence copies (Incidents > Open Evidence as Log) | `%TEMP%\TKTail\Evidence` | by Settings > Privacy & Cleanup > *Remove evidence copies* (default: a day after they were made, when TKTail starts) and by Clean Now - never one a tab shows |
| An interrupted save (`settings.ini.<number>.tmp` and similar) | the data folder | at the next start, and by Clean Now |
| A linked window's start request (`TKTail-linked-....json`) | `%TEMP%` | when the window reads it; one left over a day by Clean Now |
| An export or saved results being written (`<your file>.tmp`) | beside the file you chose | when the export ends, fails or is cancelled |

TKTail keeps no settings in the Windows Registry. The only Registry and profile entries are the optional
[Windows integration](https://tktail.dev/help/windows-integration/) ones you turn on (startup, Explorer, shortcuts), removed with
**Remove All...**.

A `.tktail` file in a log folder is written only when you choose a format for a folder there
([Folder formats](https://tktail.dev/help/local-configuration/)).

## Privacy

- **Logs you open stay where they are.** TKTail reads them; it never copies them, except what an alert keeps
  as incident evidence and an export or copy you ask for.
- **Alerts** keep a short preview of the matching line in the alert history (Settings > Alerts & Incidents:
  the line, only the matched text, or no text) and, in an incident, the records around the match. Windows
  notifications show the matching text unless you turn that off.
- **History**: recent files and folders, search terms and Search Results sessions (their queries only) are
  remembered; Settings > Privacy & Cleanup turns each off and clears them.
- **The application log** leaves file paths out unless you turn them on (Settings > Logging).
- **AI clients** (MCP) get nothing until you allow AI access, then read only what is open in TKTail - plus
  folders you approve - see [AI integration](https://tktail.dev/help/mcp/#what-the-assistant-can-and-cannot-see). Their answers name this
  TKTail by random IDs; your computer name and Windows account only if you tick them in Settings > AI Access.
- **The license** is verified on this computer; nothing is sent.

## Cleanup

**Settings > Privacy & Cleanup > Clean Now** removes TKTail's temporary files that nothing uses now - it lists
the places first:

- evidence copies no tab shows (any age),
- files an interrupted save left beside TKTail's data,
- linked-window start requests that are a day old.

It never removes your logs, exports, settings, alerts, incidents, custom formats or anything TKTail did not
make; a file another program holds open is kept. The status bar says what was removed.

Persistent data has its own limits rather than a cleanup: the alert history and incidents (Settings > Alerts &
Incidents), the application log (Settings > Logging), recent lists (Settings > Privacy & Cleanup).

## Removing TKTail

1. **Settings > Windows Integration > Remove All...** (or `tktail integration remove-all --yes`).
2. Exit TKTail and delete `TKTail.exe` (and its folder, for a portable copy).
3. Delete the data folder - `%LOCALAPPDATA%\TKTail`, or the folder you chose - if you do not want to keep your
   settings, alerts and incidents.

---

Source: https://tktail.dev/help/troubleshooting/

# Troubleshooting

## A program cannot write to its log while TKTail has it open

TKTail opens files with full sharing (read, write and delete), so normal log writers keep
working and files can be rotated or deleted while they are open. Some writers, however, ask
Windows for *exclusive* write access and fail while **any** program reads the file. Windows
PowerShell 5.1 `Add-Content` is one example - it fails the same way with other viewers.
Programs that open the file with sharing (most logging libraries, .NET `FileStream` with
`FileShare.ReadWrite`) are not affected.

## New lines appear late on a network share

The status bar says how the file is followed: `AUTO 30 s` means TKTail checks the share every
30 seconds because nothing changed for a while - the next change it sees brings it back to every
second. Some shares send no change notifications and some servers report a new size only after
their write cache is flushed; lines then appear with that delay. If you need a fixed, short
delay, choose **Poll** with a shorter interval in the Inspector (**Monitoring > Refresh**); each
check is one small request to the server. See
[Files on network shares](https://tktail.dev/help/large-and-network-files/#files-on-network-shares).

## The status bar says NO EVENTS

The file is in **Event** mode, and its folder does not deliver change notifications now (a share that
dropped them, a folder that was removed). In Event mode TKTail does not check the file itself, so new
lines appear only when the notifications work again - TKTail tries to restore them, at most once a
minute, and then catches up. To have the file checked, choose **Auto** or **Poll** in the Inspector
(**Monitoring > Refresh**).

## The status bar says OFFLINE

The share holding the file cannot be reached. TKTail keeps what it has shown and tries again
with growing pauses (up to a minute); nothing needs to be reopened when the share is back. The
Inspector's **Monitoring > Connection** row says how many tries failed.

## Reveal Current File stops before the file's folder

The folder tree does not show hidden folders unless **... > Show Hidden Items** is on, so a
path through `AppData`, for example, ends at the closest visible folder. The file list still
shows the right folder and selects the file.

## A folder shows "more files not shown"

To stay fast, the file list shows at most 100,000 files of one folder. Type a filter (for
example `*.log`): in very large folders the filter is applied while the folder is read, so
matching files beyond that limit are found.

## "Entry Point Not Found: ClosePseudoConsole" when starting TKTail

TKTail 1.0.1 and earlier stop with this message on Windows Server 2016 and Windows 10 before
version 1809: they need the Windows pseudo console at start. Later versions start there; only the
[terminal](https://tktail.dev/help/bottom-panel/#terminal) needs Windows 10 version 1809 or Windows Server 2019, and the
Terminal view says so on an older Windows. What else differs by Windows version:
[System requirements](https://tktail.dev/help/system-requirements/#features-that-need-a-newer-windows).

## Text looks too small or too large after moving TKTail to another monitor

On Windows 10 version 1607 and Windows Server 2016, the log views, their tabs and the bottom panel keep the scale they
started with when the display scale changes - another monitor, a changed scale, a Remote Desktop session at another
scale. Restart TKTail (**File > Exit**, then start it again; [the workspace comes
back](https://tktail.dev/help/viewing-logs/#when-tktail-starts-again)). Windows 10 version 1703 and
later rescale everything at once ([System requirements](https://tktail.dev/help/system-requirements/#features-that-need-a-newer-windows)).

## The Windows context menu says "(not available)"

Windows did not provide a menu for that item, or one of the programs that add items to it
failed. TKTail keeps running; the rest of its own menu works.

## Something else is wrong after changing settings

- **Settings > Restore Defaults...** resets the page you are on (see [Settings](https://tktail.dev/help/settings/)).
- Start once with `--safe-mode` to ignore the saved workspace, monitored files, alert rules,
  custom formats and folder formats (`.tktail`).
- `tktail settings list` shows every setting with its value; **Settings > Files & Storage** (or
  `tktail portable status`) shows which data folder is used.
- Settings live in `settings.ini` in the data folder ([Where TKTail stores data](https://tktail.dev/help/data-and-privacy/)).
  Rename the file to start with defaults; a line TKTail cannot read is listed in **Problems**.

## Finding out what TKTail did

**View > Tool Views > Output** lists what TKTail itself did and what went wrong - files
that disappeared or were rotated, files that could not be opened, settings that could not be
saved. The same entries are in `logs\tktail.log` in the data folder (Settings > Logging shows it and how much
is kept); **Open Log Folder** in the Output panel opens that folder. For more detail, choose **Debug** in the
Output view, or a lower level in Settings > Logging.

## Reporting a problem

Please include what you did, what you expected and what happened, plus the output of
`tktail diagnostics` (version, build, Windows version, settings state - without file paths
or log contents unless you add `--include-paths`). The application log (`tktail.log`, see above)
helps too; it contains no file paths unless `log.includePaths` is on.
