Part 3 · Advanced features / 3.2

Large files and live logs

Files of 64 MiB or more are never loaded whole. Erya switches to a read-only reading mode and checks the file for changes every 250 milliseconds, which makes it a rather good log viewer.

Reading time about 10 min Audience Anyone reading big files or logs Prerequisites 2.1 Version v1.0 ・ 2026-08-26
3.2.1

When large-file mode kicks in

There is one number: 64 MiB.

If a file is 64 MiB or larger, Erya does not read it into memory. It switches to a read-only reading mode instead, says “Opened access.log in large-file read-only mode (512 MB)”, and the mode cell of the status bar reads Large file read-only.

爾雅 Erya │ [access.log]
F1 Help Ctrl+S Save Ctrl+W Search Ctrl+R Replace Ctrl+B Block Ctrl+K Cut line Ctrl+X Exit
10.0.1.24 - - [26/Aug/2026:09:14:02 +0800] "GET /api/v1/orders HTTP/1.1" 200 10.0.1.31 - - [26/Aug/2026:09:14:02 +0800] "POST /api/v1/login HTTP/1.1" 302 10.0.2.10 - - [26/Aug/2026:09:14:03 +0800] "GET /static/app.js HTTP/1.1" 304
access.log │ 1284391:1 │ Large file read-only │ UTF-8 │ LF
Opened access.log in large-file read-only mode (512 MB)
Three kinds of big file take three different routes
  • A large UTF-8 text file → large-file read-only mode (this chapter).
  • A large binary file → a streamed hexadecimal view, also read-only (see 3.3.8).
  • A large non-UTF-8 text file (say a 200 MB Big5 export) → Erya cannot decode it as a stream, so it opens as a binary file in the hexadecimal view. Convert it to UTF-8 outside Erya if you need to edit it.
3.2.2

What you can do in this mode

Read it, search it, copy from it — but not change it.

Available

  • Scrolling, paging, Ctrl+Home / Ctrl+End
  • Ctrl+G to a line number
  • Ctrl+W search and F3
  • Selecting and Ctrl+C
  • Ctrl+L line wrap
  • Ctrl+P hexadecimal view
  • New tabs, switching tabs, exiting

Refused with “Large files use read-only mode and cannot be edited”

  • Typing, deleting, pasting, cutting, deleting lines
  • Save and Save As
  • Replace (Ctrl+R / F5 / F6)
  • Undo and redo
  • Encoding and line-ending conversion (F7 / F8)
  • Formatting, paragraph reflow, block fill and shift
  • Inserting phrases, running macros
Two things simply do not happen here
  • No syntax highlighting. Highlighting needs to parse the whole file, so it is switched off on purpose.
  • No side-by-side comparison. Choosing a large file with F4 is refused: “Side-by-side comparison is unavailable in large-file mode to avoid loading the complete file into memory” (see 3.4.9).
3.2.3

How the memory is saved

It keeps signposts, and reads a line from disk when the screen asks for it.

A 512 MB file on disk scanned once, as a stream line 1 line 4097 line 8193 line 12289 line 16385 … Memory holds only these checkpoints: one file offset every 4096 lines To show line 9000, start at the checkpoint for line 8193 and read 807 lines forward No memory mapping is used, and a single very long line is previewed to at most 1 MiB
Figure 3.2.1 The sparse line index. One scan on open builds the checkpoints; after that, lines are read as the screen needs them, so a 512 MB file does not exhaust memory. The mode has been tested with a 500 MiB file.
3.2.4

Following a growing log

Erya checks the file every 250 milliseconds, and new content simply appears.

This is where large-file mode earns its place: it is tail -f that you can also search and scroll back through.

  1. Appends are cheap. Erya rebuilds only the last incomplete line plus whatever is new; it does not rescan the file, so size does not slow it down.
  2. The cursor at the end means follow. Sitting at the end of the last line, new content pushes the view along. That is follow mode.
  3. Move away and it holds still. Scroll back to read something and the view stays where you are, undisturbed by new arrivals. Press Ctrl+End to resume following.
  4. Updates are announced with “External file update detected; content refreshed”.
The standard way to watch a log

erya /var/log/nginx/access.log → Ctrl+End to start following → Ctrl+W and F3 when you need to find something → Ctrl+End again to resume. You never leave the editor.

3.2.5

Truncation and rotation

When the file does not grow but is replaced.

What happened on diskWhat Erya doesTypical cause
Content appendedAdds just the new part; fastA service writing its log
File emptied (truncated)Reopens and rebuilds the index> access.log, logrotate with copytruncate
File rewritten in placeReopens and rebuilds the indexA report regenerated from scratch
File replaced (rotation)Reopens and rebuilds the indexlogrotate moving the old file aside
After a rotation you are looking at the new file

Erya follows the path. Once access.log has been rotated, what you see is the new file (usually empty or very short); the old content is in access.log.1. Open that in another tab if you need it.

3.2.6

External changes to ordinary files

Small files are watched too; only the response differs.

The same 250 ms check runs for ordinary files. The difference is that ordinary files can be edited, so Erya has to know whether you have (the full account is in 2.1.7):

File typeYou have not editedYou have edited
Ordinary text fileReloads automatically; undo history clearedWarns only, then asks with the red row (O/R/N) when you save
Large fileRefreshes automaticallyCannot happen — the mode does not allow edits
3.2.7

The three external-change outcomes

One table to consult when it happens.

Message rowColourWhat to do
External update detected; file safely reloadedYellowNothing. You have the current content — but the undo history is gone.
External file update detected; content refreshedYellowNothing; the automatic refresh in large-file mode.
The file changed externally; confirmation is required before savingYellowA warning only, nothing blocked yet. The question comes at save time.
File changed externally: [O]verwrite, [R]eload, [N/Esc] cancelRedA decision. When unsure press N, then F12 to save a copy (2.1.7).
Failed to refresh external file: …YellowThe file was deleted, permissions changed, or the disk misbehaved. Check that it still exists.
3.2.8

Common problems

Six questions about large-file mode.

SymptomCause and fix
Typing does nothing; it says read-onlyThe file is past 64 MiB (3.2.2). To edit it, split it outside Erya or extract the part you need.
No syntax highlightingDeliberately disabled in this mode (3.2.2).
The view keeps jumping to the endThe cursor is at the end, so it is following. Scroll back to stop it (3.2.4).
The view stopped updatingThe cursor is no longer at the end. Press Ctrl+End (3.2.4).
The log suddenly went emptyTruncation or rotation; you are on the new file (3.2.5).
A large CJK file opened as hexadecimalA large non-UTF-8 file cannot be decoded as a stream (3.2.1). Convert it to UTF-8 first.