Blueprints · Systemd & Agents
Beginner
10 min · Linux
Application logrotate
Stages a daily rotation for one application log. It does not delete logs itself.
Live config
Baked-in protections
- Rotation is daily
- Fourteen copies are kept
- The live log is not deleted by the bundle
Step 1 · conf
logrotate rule
/root/portgate-blueprints/app-logrotate
Copy to /etc/logrotate.d after the log path exists.
/var/log/app/*.log {
daily
rotate 14
missingok
notifempty
compress
delaycompress
copytruncate
}
Step 2 · bash
Read-only check
/root/portgate-blueprints/logrotate-check.sh
Prints status. It does not change the service.
#!/bin/sh set -eu du -sh "/var/log/app" 2>/dev/null || echo "Path /var/log/app is missing."