Logrotate — HMC Backup Logs Runbook

drhmc01 / drhmc02
Targets
drhmc01backup.log
drhmc02backup.log
Path
/var/log
Frequency
Weekly
Retention
12 archives
Compression
gzip / delaycompress
Strategy
copytruncate
LINUX

Procedure Steps

01 Confirm logrotate is present and cron-driven
which logrotate logrotate --version # Confirm daily cron hook is in place — present by default on RHEL/Ubuntu ls -la /etc/cron.daily/logrotate

Note: Linux distros run logrotate via /etc/cron.daily/logrotate automatically. If missing, add via crontab before relying on it.

02 Create config drop-in
vi /etc/logrotate.d/hmcbackup

Drop-in file — picked up automatically by the daily cron hook. No service restart needed.

03 Config contents
/var/log/drhmc01backup.log /var/log/drhmc02backup.log { weekly rotate 12 compress delaycompress missingok notifempty copytruncate dateext dateformat -%Y%m%d }

copytruncate chosen because the VTL scripts append with >> and don't trap SIGHUP. Copies the file then truncates the original in place — preserves open file handles.

dateext produces drhmc01backup.log-20260430.gz instead of .1.gz — far easier to grep historically.

04 Validate (dry run)
logrotate -d /etc/logrotate.d/hmcbackup

-d = debug, no changes made. Read output carefully — confirms both log paths are matched and shows the actions logrotate would take.

05 Force a real run and verify
logrotate -f /etc/logrotate.d/hmcbackup # Confirm rotated archives appeared ls -la /var/log/drhmc0*backup.log* # Confirm state file tracks the rotation grep drhmc /var/lib/logrotate/logrotate.status

-f forces rotation regardless of frequency. Both files should appear in the state file with today's date.

AIX

Procedure Steps

01 Confirm logrotate install paths
which logrotate logrotate --version # Toolbox builds typically install to /opt/freeware rpm -ql logrotate | grep -E 'status|logrotate.conf|cron'

Note: AIX Toolbox builds usually live under /opt/freeware with symlinks into /usr/bin. State file is typically /var/lib/logrotate.status but may be /opt/freeware/var/lib/logrotate.status.

02 Verify cron schedule — AIX has no /etc/cron.daily
# Check root's crontab for an existing logrotate entry crontab -l | grep logrotate # If nothing returns, schedule it manually: crontab -e
# Add to root's crontab — daily at 02:30 30 2 * * * /usr/bin/logrotate /etc/logrotate.conf >/dev/null 2>&1

Critical: AIX has no /etc/cron.daily framework. The Toolbox RPM does not always drop a cron hook — verify and add manually if missing or rotation will silently never run.

03 Create config drop-in
vi /etc/logrotate.d/hmcbackup

Same path convention as Linux. Confirm /etc/logrotate.conf contains include /etc/logrotate.d — Toolbox default does, but worth checking.

04 Config contents (AIX-adjusted)
/var/log/drhmc01backup.log /var/log/drhmc02backup.log { weekly rotate 12 compress delaycompress missingok notifempty copytruncate dateext dateformat -%Y%m%d }

copytruncate mandatory here — AIX ksh holds the log open via >> and won't reopen on rotation. create-style rotation would break logging until the VTL script restarts.

If using create instead — use group system, not root: create 0640 root system.

05 Validate, force-run, verify
# Dry run logrotate -d /etc/logrotate.d/hmcbackup # Force real rotation logrotate -f /etc/logrotate.d/hmcbackup # Verify archives exist ls -la /var/log/drhmc0*backup.log* # Confirm state tracking — try both common paths cat /var/lib/logrotate.status 2>/dev/null || \ cat /opt/freeware/var/lib/logrotate.status # Sanity check AIX errpt for any IO/permissions issues errpt | head
⚠ Key Notes