Skip to main content

Module console

Module console 

Source
Expand description

Each instance’s console output, kept in one SQLite database per host so that every reader sees all of it.

incus hands a running container’s console output out once: each GET .../console drains what it returns, so a second reader sees only what was written since the first. Every isb process on the host (the daemon, the TUI, isb logs, isb up), whichever user runs it, therefore records what it drains in dir/console.db and reads from there. The drain happens inside the database’s write transaction, so two readers never record their chunks out of order.

The directory is root:incus-admin 2770 (isb host setup makes it): whoever may use the incus socket may use the log, and the database and its WAL files are 0660 in the directory’s group. Where it does not exist or cannot be written, the user’s own $XDG_STATE_HOME/isb/console.db stands in, shared only by that user’s processes.

A log is chunks, each at its position in bytes since the log began, so a follower’s position survives trimming the oldest.

Constants§

DEFAULT_DIR
Where the host’s console database lives, unless ISB_CONSOLE_DIR says otherwise.
KEEP
How much of each instance’s console output is kept (whole chunks: up to one chunk more).

Functions§

dir
The host’s console directory.