mediumMultiple ChoiceObjective-mapped
XK0-006 Practice Question: A Linux administrator receives reports that the…
A Linux administrator receives reports that the system's log files are growing rapidly and consuming disk space. The administrator needs to configure the system to rotate logs weekly, keep 4 weeks of logs, compress old logs, and ensure that log rotation does not cause logs to be lost if the log file is still being written. Which configuration file and setting should be used?
⚠ Common exam trap
A common mix-up: candidates confuse the roles of rsyslog.conf (log generation) with logrotate.conf (log rotation), or assume that systemd-journald's journal management is equivalent to traditional log file rotation, when in fact logrotate is the standard tool for rotating plain-text log files on Linux systems.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
/etc/logrotate.d/syslog with directives: weekly, rotate 4, compress, delaycompress
The logrotate utility is specifically designed for log rotation, and the configuration file /etc/logrotate.d/syslog is the standard location for per-service rotation rules. The directives 'weekly', 'rotate 4', 'compress', and 'delaycompress' together achieve weekly rotation, retain 4 weeks of logs, compress old logs, and prevent data loss by delaying compression until the next rotation cycle, ensuring the log file is no longer being written to.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
/etc/rsyslog.conf with action(type="omfile" file="/var/log/syslog" rotate="weekly" keep="4" compress)
Why it's wrong here
rsyslog does not perform rotation; rotation is handled by logrotate.
- ✓
/etc/logrotate.d/syslog with directives: weekly, rotate 4, compress, delaycompress
Why this is correct
logrotate is the standard tool; delaycompress ensures current log is not compressed until next rotation, preventing data loss.
- ✗
/etc/systemd/journald.conf with Settings=MaxRetentionSec=4weeks and Compress=yes
Why it's wrong here
journald manages binary logs, not text log files like syslog.
- ✗
/etc/cron.daily/logrotate script that calls logrotate -f /etc/logrotate.conf
Why it's wrong here
This forces all rotations daily, but does not specify the retention and compression settings needed.
Go deeper
Related to this question
Learn chapter
Linux Fundamentals and History
Key term
Utility
Utility, in IT service management, is the measure of a service's functionality that ensures it is fit for purpose by meeting the specific needs of the customer.
Key term
Linux
Linux is an open-source operating system that manages computer hardware and software, widely used in servers, desktops, and embedded systems.
About these practice questions
One of 979 original XK0-006 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This XK0-006 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the XK0-006 exam.