Which approach configures log rotation to run daily and keep 14 rotated logs?

Prepare for the Red Hat Certified Systems Admin Exam EX200. Enhance your skills with interactive quizzes, flashcards, and detailed explanations. Ace your certification exam today!

Multiple Choice

Which approach configures log rotation to run daily and keep 14 rotated logs?

Explanation:
Log rotation is driven by a main configuration that includes per-log rules. The preferred approach is to put a dedicated rule for the specific log under /etc/logrotate.d, where you set daily to rotate each day and rotate 14 to keep the latest 14 rotated backups. Since /etc/logrotate.conf includes the files in /etc/logrotate.d, adding your own file automatically becomes part of the overall rotation policy. Running logrotate with the main configuration, for example logrotate -f /etc/logrotate.conf, applies the rules immediately (the -f flag forces rotation, which is useful for testing or applying right away). This modular method is better than editing the central file because it keeps policies isolated and easier to manage. Using -d would only simulate rotation, not perform it, and relying on a separate crontab entry to run logrotate daily bypasses the built-in, centralized scheduling and configuration mechanism.

Log rotation is driven by a main configuration that includes per-log rules. The preferred approach is to put a dedicated rule for the specific log under /etc/logrotate.d, where you set daily to rotate each day and rotate 14 to keep the latest 14 rotated backups. Since /etc/logrotate.conf includes the files in /etc/logrotate.d, adding your own file automatically becomes part of the overall rotation policy. Running logrotate with the main configuration, for example logrotate -f /etc/logrotate.conf, applies the rules immediately (the -f flag forces rotation, which is useful for testing or applying right away). This modular method is better than editing the central file because it keeps policies isolated and easier to manage. Using -d would only simulate rotation, not perform it, and relying on a separate crontab entry to run logrotate daily bypasses the built-in, centralized scheduling and configuration mechanism.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy