Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Search

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

You wantUse
The next place in this fileFind - Ctrl+F (below)
Every match in all open files and event logsFind 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 logsAdvanced Search - Ctrl+Alt+F (Advanced Search)
Only among the results of a searchSearch Within These Results (Search Results)
One thing, then another within a time window (“a WARN, then an ERROR within 30 s”)a sequence in Advanced Search (Sequences)
Files by name or content in a folder - without opening themthe Explorer’s Search Files… / Search Contents… (Searching folders)
Events in an event logFind in an event tab (Finding events)
The same question again latera Saved Search (Save the question, save the answer)
The results kept across a restart, or kept before the log rotatesPin Search, then Save as 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 - 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: 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 - unless you ask for the whole record. 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, a JSON payload), the line that matches is found and the Inspector / RECORD show the whole entry, and two texts on different lines of one entry are not one match: ALL of Text in a line Error deserializing json and Text in a line RISK finds nothing when RISK is on a later line. To look at the whole entry, choose Text in the whole record (or Regular expression in the whole record) in Advanced Search: ALL of the two then finds that entry once, on its first line, wherever the two texts are. The record is the one the format frames - the same one RECORD and the Inspector show, its lines joined by line breaks (very long entries: up to 2,000 lines / 4 MB at a time - a longer entry is read in parts, and a text not found in a part is not known, never not there: the search then says it is incomplete and how many entries it could not read whole). In a whole-record regular expression ^ and $ are the start and the end of the entry, (?m) makes them each line’s, and \n is a line break. It works the same in open files, folders, .gz files, a log’s history and archive entries. (A field’s value still comes from the entry’s first line: message contains RISK does not find RISK on a stack-frame line - use the whole record for that.)
  • 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.
  • When the format already has the value as a field, ask the field, not a regular expression: time-taken >= 1000 on an IIS log (or a column of your own format) is read straight from the record - TKTail can even decide most records without decoding them - while a regular expression has to run on every line. Keep regular expressions for text no format describes (or teach the format once with Custom Format Studio).

Testing a regular expression

Try a pattern on your own text before you search, alert or protect with it: Tools > Regular Expression Tester…, or Test… beside a pattern - in Advanced Search (with .* on), in a Regular expression condition of the search builder, in the alert editor, in an AI Data Protection rule and in the pattern rows of Custom Format Studio.

  • The same engine and rules as the place it is for. Tested as says which: Search - a line, Search - the whole record, Alert - a line, Alert - the whole record, AI Data Protection rule, or Custom format (ECMAScript) - custom formats use a different engine, so a pattern that works in a search may not work there. Opened from a field, the tester uses that field’s kind; the note at the bottom says what it means (one line at a time, the whole record with lines joined by \n, the size limits).
  • Paste a sample (or type it); the result follows as you type: Valid or Invalid with the position of the mistake, the matches with their line and columns, each group by number or name, and empty matches (a search never reports those). A pattern that runs away says so, as the search would. Select a match to see it in the sample.
  • AI Data Protection rule: the Replacement and a preview of the sample as an AI client would receive it (this rule together with the built-in rules) - the secret group replaced if the pattern has one, else the whole match.
  • Use Expression puts the pattern (and Match case, the replacement) back into the field you came from; nothing is saved until you save there. Close changes nothing.
  • The sample stays in this TKTail window for the session only: never saved, never sent to an AI client.

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.

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
Wherethe 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.
Textliteral text, or a regular expression (TKTail Regex v1), each line tested on its own; Aa matches case.
Fieldsfield = 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, and your own.
Timeany time, the last 15 minutes / hour / 24 hours, today, or between two times; each record by its own time (Advanced Search). Go To a time: Ctrl+Shift+G (Viewing logs).
Combineall of / any of, groups inside groups (up to 32 conditions and groups, 4 levels), conditions per source (The builder).
Event logsin 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).
SequencesTemporal 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).
Resultsa 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).
KeepSaved Searches (the question, also as a .tktsearch.json file) and saved results (the answer, a .tktresults file) (Save the question, save the answer).
Command linetktail 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).