Script to Backup/Cleanup AtScale Postgres Logs

This document provides instructions on how to backup Postgres logs and deletes as needed.

Below commands can be used (If HA, then on both nodes) for backing up the Postgres logs periodically and deleting them as needed.

-- Command to backup Postgres logs older than 10 days as zip to /tmp which can be moved/stored on a backup partition:

find /opt/atscale/log/database/*.log -mtime +10 | xargs tar --no-recursion -czf /tmp/oldpglogs_$(date '+%F').tgz


-- Once Postgres logs are backed up then delete files older than 10days:

find /opt/atscale/log/database/*.log -mtime +10 -delete

Was this article helpful?

0 out of 0 found this helpful