Archive Large Logs and Move Them Over SFTP

Application logs can fill a server disk faster than anything else. Archiving old logs to a separate storage server frees space and keeps the history for audits.
Find the logs
Run WinDirStat on the server volume and sort by size. Look for folders named logs, archive or dump, and for files
with extensions such as .log, .etl or .dmp. Note the path and the owning application.
Archive
- Stop the application only if its documentation says it is safe. Many services can rotate logs without a restart.
- Compress each folder of logs older than the retention period, for example 30 days, into one archive per month.
- Store the archive name with the server, application and date.
Move with WinSCP
- Connect to the storage server with SFTP, using key-based authentication.
- Upload the archives to a dedicated folder, such as
/srv/archive/servername/. - Compare the file sizes on both sides before you delete anything from the source.
Delete only after verification
Delete the local logs only after the archive has been opened or hash-checked on the storage server. Record the deletion in your change log, so the retention history can be proven.
See the secure file transfer checklist before you set up the transfer.