A saved wget log makes unattended downloads easier to audit when a transfer runs from cron, a long-lived shell, or a service account. Keeping the request target, destination file, and final transfer result in one place is more reliable than depending on terminal scrollback.
Wget writes its status messages separately from the downloaded payload, so --output-file can start a fresh run log without changing the destination filename. When multiple scheduled runs belong in the same audit trail, --append-output keeps the later entries together in chronological order.
Those logs can expose URLs, redirected locations, filenames, and debug details that do not belong in a world-readable directory. Store them in a private path, rotate append-mode logs before they grow noisy, and reserve --debug for short troubleshooting windows because it records much more connection detail.
Related: How to run wget downloads in the background
Related: How to debug wget connections
Related: How to control wget download progress output
Steps to log wget output to a file:
- Create a dedicated log directory with restricted permissions before storing transfer logs there.
$ mkdir -p ~/logs/wget $ chmod 700 ~/logs/wget
A private log directory keeps transfer telemetry separate from downloaded payloads and reduces accidental disclosure.
- Write one transfer to a fresh log file with --output-file.
$ LOGFILE=~/logs/wget/transfer-audit.log $ wget --output-file="$LOGFILE" --no-verbose \ https://downloads.example.net/exports/inventory-2026-03-29.csv.gz \ -O inventory-2026-03-29.csv.gz
--output-file replaces the old file contents, which is useful for one-off diagnostics or a clean single-run audit.
- Append later runs to the same file with --append-output when one continuous history is more useful than isolated logs.
$ LOGFILE=~/logs/wget/transfer-audit.log $ wget --append-output="$LOGFILE" --no-verbose \ https://downloads.example.net/exports/pricing-2026-03-29.csv.gz \ -O pricing-2026-03-29.csv.gz
Append mode is the better choice for recurring jobs, scheduled downloads, and repeated checks against the same endpoint family.
- Review the most recent log lines and confirm that the payload files were written separately.
$ tail -n 10 ~/logs/wget/transfer-audit.log 2026-03-29 09:28:14 URL:https://downloads.example.net/exports/inventory-2026-03-29.csv.gz [15248/15248] -> "inventory-2026-03-29.csv.gz" [1] 2026-03-29 09:29:03 URL:https://downloads.example.net/exports/pricing-2026-03-29.csv.gz [8241/8241] -> "pricing-2026-03-29.csv.gz" [1] $ ls -lh inventory-2026-03-29.csv.gz pricing-2026-03-29.csv.gz -rw-r--r-- 1 automation automation 15K Mar 29 09:28 inventory-2026-03-29.csv.gz -rw-r--r-- 1 automation automation 8.1K Mar 29 09:29 pricing-2026-03-29.csv.gz
The log records transfer events only; the actual payload still lands in the destination file named on the command line.
- Increase detail by combining --debug with a file log when normal output is not enough.
$ wget --debug --output-file=~/logs/wget/wget-debug.log --spider \ https://downloads.example.net/exports/restricted-inventory-2026-03-29.csv.gz
Debug logs are much more verbose and may include sensitive request details, so rotate or remove them after the troubleshooting pass.
- Keep recurring logs under control with dated filenames or periodic cleanup.
$ ls -1 ~/logs/wget/transfer-*.log /home/automation/logs/wget/transfer-2026-03-28.log /home/automation/logs/wget/transfer-2026-03-29.log $ du -h ~/logs/wget/transfer-*.log 4.0K /home/automation/logs/wget/transfer-2026-03-28.log 4.0K /home/automation/logs/wget/transfer-2026-03-29.log
A naming pattern such as transfer-$(date +%F).log keeps long-running download hosts easier to audit and rotate.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
