tmxlog is a tmux-first logging CLI for Ubuntu-style terminal workflows.
It wraps tmux pipe-pane and lets you manage logging in a predictable process model:
- start / stop = lifecycle of a logging process
- attach / detach = include/exclude tmux sessions from a logging process
Traditional tools like script are great for single-shell capture.
tmxlog is built for tmux users who need:
- merged logs from multiple tmux sessions and panes
- explicit separation between process lifecycle and session inclusion
- process IDs (not just log-path-centric behavior)
- automatic handling for newly created panes in attached sessions
start <log_path>creates a logging process only.startdoes not auto-attach any session.attach/detachsupport:- explicit session targeting with
-t/--target - implicit current session targeting when run inside tmux without
-t
- explicit session targeting with
- Process IDs are auto-indexed (next free numeric ID).
- If
-pis omitted onattach/detach/stop, tmxlog falls back to the most recently created active process. stopmarks the process inactive and detaches attached sessions.
For full beginner-friendly Ubuntu setup, see:
Quick build:
go build -o tmxlog ./cmd/tmxlogOptional global install:
sudo install -m 0755 ./tmxlog /usr/local/bin/tmxlogtmxlog start <log_path>
tmxlog stop [-p <process_id>]
tmxlog attach [-p <process_id>] [-t <tmux_target>]
tmxlog detach [-p <process_id>] [-t <tmux_target>]Internal commands (invoked by tmux integration):
tmxlog _ingest --process <id> --session <name> --pane <pane_id>
tmxlog _attach-session-panes --process <id> --session <name>tmxlog start ~/tmx-logs/team.logExample output:
started logging process 0 -> /home/user/tmx-logs/team.log
Attach by target name/index:
tmxlog attach -p 0 -t dev
tmxlog attach -p 0 -t 1Attach current session from inside tmux:
tmxlog attach -p 0tmxlog detach -p 0 -t devOr, from inside tmux for current session:
tmxlog detach -p 0tmxlog stop -p 0When omitted, -p falls back to most recent active process:
tmxlog stoptmxlog start /tmp/a.log # process 0
tmxlog start /tmp/b.log # process 1 (latest)
tmxlog attach -t dev # attaches dev to process 1
tmxlog detach -t dev # detaches from process 1
tmxlog stop # stops process 1Each ingested line is written with metadata:
<timestamp> [proc:<id>] [session:<name>] [pane:<pane_id>] <raw pane line>
This gives merged, chronological, multi-session logs with source context.
tmxlog applies pipe-pane -o to panes in attached sessions and installs tmux hooks so panes created later in those sessions are automatically included.
Default state path:
~/.local/state/tmxlog/state.json
Override state file:
export TMXLOG_STATE_FILE=/custom/path/state.jsoncmd/tmxlog/main.go: binary entry pointinternal/app: command routing and orchestrationinternal/cli: argument parsing/validationinternal/process: lifecycle/session/ingestion core logicinternal/state: persisted process/session metadata storeinternal/tmux: tmux command wrapperinternal/util: environment and path helpers
This layered design keeps responsibilities narrow and implementation maintainable.
gofmt -w ./cmd ./internal
go test ./...
go build ./cmd/tmxlog