Skip to content

Logging

Connect emits rich, structured logs so you can follow every transfer. Messages appear on the console in interactive mode and can be redirected or formatted for automation.

  • Interactive mode (default) paints progress bars and compact summaries for humans.
  • Batch mode (--batch) switches to line-by-line logs that are easy to tail or capture in files.

Connect will automatically fall back to batch mode when it cannot allocate an interactive console (for example, when stdout is not a TTY).

Terminal window
$ connect move ~/payloads/*.zip sftp://monitor01:[email protected]/incoming/
[file1.zip] 1.00 MiB / 1.00 MiB done
[file2.zip] 1.00 MiB / 1.00 MiB done

When running in interactive mode (the default), Connect displays helpful progress bars that allow you to monitor the status of your data transfers in real-time. These visual indicators provide immediate feedback on transfer progress.

Each progress bar displays the following information for active transfers:

  • File name — The name of the file being transferred
  • Bytes transferred — Current progress shown as transferred / total (e.g., 1.00 MiB / 5.00 MiB)
  • Transfer rate — Current speed of the transfer (e.g., 4.5 MB/s)
  • Estimated time remaining — Time until completion (e.g., ETA: 00:12)
  • Percentage complete — Visual progress indicator
Terminal window
$ connect sync ~/data/ sftp://server:[email protected]/backup/
[file1.zip] ████████████████████░░░░░░░░ 64% | 3.20 MiB / 5.00 MiB | 4.2 MB/s | ETA: 00:07
[file2.zip] ████████████████████████████ 100% | 2.50 MiB / 2.50 MiB | 5.1 MB/s | done
[file3.zip] ░░░░░░░░░░░░░░░░░░░░░░░░░░░ 0% | 0.00 MiB / 3.00 MiB | waiting...

When using parallel uploads, multiple progress bars are displayed simultaneously, one for each active transfer. This allows you to monitor the status of all concurrent operations at a glance.

  • Progress bars update in real-time as data is transferred
  • Completed transfers show a “done” status and remain briefly for confirmation
  • The display automatically adjusts based on terminal width
  • Progress bars are only shown in interactive mode (TTY output)
  • In batch mode or when stdout is redirected, progress bars are replaced with log entries

You can control progress bar display through the following flags:

  • --batch — Disables progress bars and uses line-by-line logging instead
  • --quiet — Suppresses all output including progress bars (use with --batch for exit code only)
  • --no-color — Removes color formatting from progress bars and other output
Terminal window
$ connect move --batch --no-color \
~/payloads/*.zip \
sftp://monitor01:[email protected]/incoming/
2025/06/27 13:03:24 INFO Moving files to sftp://[email protected]/incoming/
2025/06/27 13:03:24 INFO Discovering sources pattern="/home/ops/payloads/*.zip" matches=2
2025/06/27 13:03:25 INFO Transferring file=file1.zip sftpSessionID=1
2025/06/27 13:03:25 INFO File transferred successfully bytesTransferred=1048576 duration=153ms transferRate=6.52MB/s file=file1.zip sftpSessionID=1
2025/06/27 13:03:25 INFO Transferring file=file2.zip sftpSessionID=1
2025/06/27 13:03:25 INFO File transferred successfully bytesTransferred=1048576 duration=60ms transferRate=16.62MB/s file=file2.zip sftpSessionID=1
  • INFO — expected activity (discovery, transfers, cleanup).
  • WARN — something noteworthy but non-fatal (e.g., no files matched).
  • ERROR — an operation failed and Connect exited with a non-zero status.
Terminal window
$ connect ls --batch sftp://monitor01:[email protected]/incoming/regex:^report.*\.csv$
2025/06/27 11:35:34 INFO Listing sftp://[email protected]/incoming/ pattern="regex:^report.*\\.csv$"
2025/06/27 11:35:35 WARN No entries matched filter pattern
Terminal window
$ connect move --batch ~/payloads/*.zip sftp://monitor01:[email protected]/incoming/
2025/06/27 11:36:21 INFO Moving files to sftp://[email protected]/incoming/
2025/06/27 11:36:22 ERROR Failed to open SFTP session error=ssh: unable to authenticate, attempted methods [none password], no supported methods remain

Specify --log-format json to emit structured JSON.

Terminal window
$ connect move --batch --log-format json ~/payloads/*.zip sftp://monitor01:[email protected]/incoming/
{"time":"2025-06-27T13:13:42.929477+02:00","level":"INFO","msg":"Moving files","destination":"sftp://[email protected]/incoming/"}
{"time":"2025-06-27T13:13:45.219012+02:00","level":"INFO","msg":"Transferring","file":"file1.zip"}
{"time":"2025-06-27T13:13:45.452400+02:00","level":"INFO","msg":"File transferred successfully","file":"file1.zip","bytesTransferred":1048576,"duration":"207ms","transferRate":"4.81MB/s"}

Batch output is plain text, so redirect with >> or pipe into another tool.

Terminal window
$ connect move --batch --no-color ~/payloads/*.zip sftp://monitor01:[email protected]/incoming/ >> /var/log/connect/job1.log
$ tail -n3 /var/log/connect/job1.log
2025/06/29 08:48:26 INFO File transferred successfully bytesTransferred=1048576 duration=61ms transferRate=16.39MB/s file=file2.zip sftpSessionID=1
2025/06/29 08:48:26 INFO Remove source path=/home/ops/payloads/file2.zip
2025/06/29 08:48:26 INFO Move complete

Use --quiet --batch when you only care about the exit code (0 on success).

Terminal window
$ connect move --batch --quiet ~/payloads/*.zip sftp://monitor01:[email protected]/incoming/
$ echo $?
0