A company's security policy states that archived web-server logs must be deleted after 180 days. The logs are stored on a Linux server that already rotates /var/log/httpd/access.log every day. Which single logrotate directive will ensure that any rotated log files older than the 180-day limit are automatically removed?
Add "rotate 180" to the logrotate configuration
Add "size 180M" to the logrotate configuration
Add the "delaycompress" directive to the rotation stanza
The maxage directive enforces time-based retention. Setting "maxage 180" tells logrotate to discard rotated archives that are more than 180 days old, regardless of how many files exist. The rotate directive limits the number of archives kept, not their age. The size directive triggers rotation when a file reaches a given size but does not control retention, and delaycompress only postpones compression of the most recent archive; it has no effect on how long archives are kept.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the 'maxage' directive do in logrotate?
Open an interactive chat with Bash
How is 'rotate' different from 'maxage' in logrotate?
Open an interactive chat with Bash
What is the purpose of the 'delaycompress' directive in logrotate?