SSH Log Collector & Command Executor
The name Retri comes from Retriever — the dog breed famous for fetching things back. Just like a retriever, this tool goes out to your servers and brings back logs.
It was born from a desire to replicate the TeraTerm log + macro workflow in WSL (Windows Subsystem for Linux): define your commands in a config file, and Retri handles SSH connections, execution, and log saving automatically.
- Local Session Recording: Run without any arguments to record your current shell session to a log file — just like TeraTerm's log function.
- SSH Session Recording: Pass a hostname as an argument to SSH into a remote host and record the entire session automatically.
- Automated Command Execution: Execute commands across multiple hosts and save timestamped logs — equivalent to a TeraTerm macro.
- Agentless: Works with standard SSH. No software required on remote hosts.
- Dependency Free: Single binary (statically linked). Download and run.
- Network Device Support: Handles interactive PTY sessions for Cisco IOS, Arista EOS, Juniper, Huawei, etc. Passwords are never written to logs.
- Parallel Execution: Run commands on multiple servers concurrently.
- SSH Config Aware: Fully supports
~/.ssh/config(aliases, proxy jumps, identity files).
curl -fsSL $(curl -fsSL https://api.github.com/repos/cotta-dev/retri/releases/latest \
| grep browser_download_url | grep "$(dpkg --print-architecture).deb" | cut -d'"' -f4) \
-o /tmp/retri.deb && sudo apt-get install -y /tmp/retri.debOr download the .deb manually from the Releases page:
cp retri_VERSION_amd64.deb /tmp/
sudo apt-get install -y /tmp/retri_VERSION_amd64.debgit clone https://github.com/cotta-dev/retri.git
cd retri
CGO_ENABLED=0 go build -o retri -ldflags="-s -w" .CGO_ENABLED=0 go install github.com/cotta-dev/retri@latestRunning retri without any arguments starts recording your current shell session to a log file.
retri
# → starts logging to ~/retri-logs/hostname_YYYYMMDD_HHmmss.log
# → type 'exit' or press Ctrl-D to stop recordingPass a hostname to SSH into the remote host and record the entire interactive session.
retri myserver
# → SSHes to myserver and records the session to ~/retri-logs/myserver_YYYYMMDD_HHmmss.log
# → type 'exit' to disconnect and stop recordingRun a command on a single host (using ~/.ssh/config alias):
retri --host myserver --command "df -h"Run commands on a group of servers defined in config:
retri --group web_serversSee docs/cli-options.md for the full option reference.
On the first run, retri automatically creates a default configuration file at ~/.config/retri/config.yaml.
See docs/config-reference.yaml for the complete parameter reference of each section.
Avoid hardcoding passwords in the config file. Retri supports ${VAR} expansion:
export COMMON_SSH_PASSWORD="my_secret_password"defaults:
password: "${COMMON_SSH_PASSWORD}"Fallback environment variables (lowest priority):
| Variable | Description |
|---|---|
RETRI_SSH_PASSWORD |
Default SSH password if no other config is found. |
RETRI_SSH_SECRET |
Default sudo secret if no other config is found. |
Logs are saved to ~/retri-logs by default.
File: myserver_20260403_010842.log
============================================================
TARGET HOST : myserver
DEVICE TYPE : linux
START TIME : 2026-04-03 01:08:42
============================================================
[2026-04-03 01:08:43.550]
[2026-04-03 01:08:43.551] ----------------------------------------
[2026-04-03 01:08:43.551] [EXEC] uptime
[2026-04-03 01:08:43.551] ----------------------------------------
[2026-04-03 01:08:43.594] 01:08:43 up 77 days, 9:44, 0 user, load average: 0.10, 0.56, 0.40
[2026-04-03 01:08:43.595]
[2026-04-03 01:08:43.595] ----------------------------------------
[2026-04-03 01:08:43.595] [EXEC] sudo whoami
[2026-04-03 01:08:43.595] ----------------------------------------
[2026-04-03 01:08:43.596] root
============================================================
LOG END : 2026-04-03 01:08:43
============================================================
Distributed under the MIT License. See LICENSE for more information.