LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

llm-logs

Browse and control the SQLite prompt log used by llm

TLDR

Show the 3 most recent prompts and replies
$ llm logs list
copy
Show the 10 most recent entries
$ llm logs list -n 10
copy
Search prompts and responses
$ llm logs list -q "[cheesecake]"
copy
Print only the latest reply as plain text
$ llm logs list -r
copy
Show whether logging is on and the database size
$ llm logs status
copy
Turn logging off (or back on)
$ llm logs off
copy
$ llm logs on
copy
Print the logs.db path
$ llm logs path
copy
Back up the database
$ llm logs backup [path/to/backup.db]
copy

SYNOPSIS

llm logs [options] [command]llm logs list [options]llm logs statusllm logs onllm logs offllm logs pathllm logs backup file

DESCRIPTION

llm logs reads the SQLite database where llm records prompts and model replies. The default file is logs.db in the LLM user directory (llm logs path). datasette "$(llm logs path)" is the documented browser for that file.Current LLM versions write a content-addressed store (threads, turns, messages, parts). Older responses rows stay visible: llm logs merges both generations. Search uses FTS5 over the user prompt and assistant text.

PARAMETERS

list

Show logged prompts and responses. Default subcommand (llm logs). Markdown of the last 3 entries unless -n is set.
-n, --count N
Number of entries. Default 3. 0 means all.
-q, --query text
SQLite FTS5 search over prompt and response text (not system prompts, fragment bodies, tool output, or reasoning). Prompt matches rank above response matches. Phrase queries use double quotes.
-l, --latest
With -q, sort newest first instead of by relevance.
-m, --model id
Filter by model id or alias.
-c, --current
Current conversation only.
--cid, --conversation id
One conversation / thread id.
-r, --response
Print only the last response as plain text.
-s, --short
Compact YAML: truncated prompts, no responses.
-t, --truncate
Truncate long strings (handy with --json).
-u, --usage
Include token counts.
--json
JSON array of log records (legacy responses rows merged with the current message store).
-x, --extract / --xl, --extract-last
First or last fenced code block from the selected entries.
-d, --database file
Alternate log database.
-f, --fragment ref
Responses that used this fragment (hash, alias, URL, or path). Repeatable (AND). -e / --expand inlines fragment text.
-T, --tool name
Responses that actually ran this tool. Repeatable. --tools matches any tool result.
--schema / --schema-multi
Filter by structured-output schema. --data, --data-array, --data-key, --data-ids extract JSON payloads.
--id-gt / --id-gte id
Rows with id greater than (or equal to) id. Ids increase with time.
status
Whether default logging is on, plus path, thread/turn counts, and file size.
on / off
Default logging for future prompts. A single call still honors llm --log / llm --no-log.
path
Absolute path of logs.db.
backup file
Copy the database with SQLite VACUUM INTO.

CONFIGURATION

logs.db

Linux: ~/.config/io.datasette.llm/logs.db. macOS: ~/Library/Application Support/io.datasette.llm/logs.db.
LLM_USER_PATH
Relocates the user directory, including logs.

INSTALL

brew install llm
copy
nix profile install nixpkgs#llm
copy

CAVEATS

Subcommand of llm. Logs are plaintext (prompts, replies, and often secrets pasted into chats). -q does not search system prompts, fragment contents, or reasoning traces. off only changes the default; --log still records one call. Backup files contain the same secrets as logs.db.

SEE ALSO

llm(1), llm-keys(1), llm-models(1), datasette(1), sqlite3(1)

RESOURCES

Copied to clipboard
Kai