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

*Screenshot: Today's log LIVE beside yesterday's, the Inspector's Dated Series section*

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

---

The HTML page: https://tktail.dev/help/rotating-dated-logs/
