hardMultiple ChoiceObjective-mapped
XK0-006 Practice Question: A company runs a critical web application on a…
A company runs a critical web application on a single Linux server. The application consists of a Node.js backend and a PostgreSQL database. The server is running out of disk space frequently due to application logs. The administrator wants to implement a log rotation solution that is automated, minimizes data loss, and compresses old logs. The administrator has root access and wants to use built-in tools. Currently, logs are written to /var/log/app/access.log and /var/log/app/error.log. The application never closes its log files. Which of the following is the best course of action?
⚠ Common exam trap
Test-takers frequently assume logrotate always requires the application to close its log files (via postrotate scripts), but the copytruncate option is specifically designed for applications that keep file handles open, making it the correct choice when the application never closes its logs.
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
✓
Configure logrotate with daily rotation, compression, and the copytruncate option.
Logrotate with the copytruncate option allows the log file to be rotated without requiring the application to close or reopen its file handles. This is essential since the application never closes its log files. Daily rotation with compression addresses the frequent disk space issue while minimizing data loss, and logrotate is a built-in Linux tool that runs automatically via cron.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Configure the systemd journal to capture the application logs and set MaxRetentionSec.
Why it's wrong here
journald is for systemd-journald logs, not arbitrary files.
- ✗
Create a cron job that runs every hour to move the logs to a backup directory and restart the application.
Why it's wrong here
Restarting causes downtime and moving open files may lose data.
- ✓
Configure logrotate with daily rotation, compression, and the copytruncate option.
Why this is correct
copytruncate allows rotation of open files without restarting.
- ✗
Configure logrotate with a weekly rotation and no copytruncate, since the application will eventually close the log files.
Why it's wrong here
Without copytruncate, logrotate cannot rotate open files.
Go deeper
Related to this question
Learn chapter
Linux Fundamentals and History
Key term
cron
Cron is a time-based job scheduler in Unix-like operating systems that automatically runs commands or scripts at specified dates and times.
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
This XK0-006 question is part of Courseiva's 979-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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.