Courseiva
mediumMultiple ChoiceObjective-mapped

XK0-006 Practice Question: A company runs a web application on a Linux…

A company runs a web application on a Linux server (Ubuntu 22.04). The application writes log files to /var/log/app/access.log and error.log. Over time, these logs have grown to several gigabytes, causing the /var partition to reach 98% capacity. The administrator decides to implement log rotation using logrotate. They create a configuration file at /etc/logrotate.d/app with the following content:

/var/log/app/*.log { weekly rotate 7 compress delaycompress size 100M missingok

}

They then run `logrotate -d /etc/logrotate.d/app` for debugging, which indicates no errors. However, after several days, the logs are not being rotated. Which step should the administrator take to resolve this?

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

Ensure that the logrotate cron job is enabled and that the configuration file is readable (644) and owned by root.

The most likely cause is that the logrotate cron job (typically /etc/cron.daily/logrotate) is not enabled or not running, or the configuration file has incorrect permissions. The administrator should verify that the cron job is active and that the config file is readable (644) and owned by root so that the cron process can execute it daily. Option B (changing ownership of /var/log/app) is unnecessary because logrotate runs as root and can read any file. Option C (forcing rotation with -f) only rotates logs once and does not fix the underlying scheduling issue. Option D (adding an hourly cron job) is excessive; logrotate is designed to run daily, and hourly rotation would be inappropriate for weekly rotation with size constraints.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Ensure that the logrotate cron job is enabled and that the configuration file is readable (644) and owned by root.

    Why this is correct

    The cron job may be disabled or the config file may have wrong permissions; these are common pitfalls.

  • Change the ownership of /var/log/app to appuser:appgroup.

    Why it's wrong here

    logrotate runs as root, so ownership of the log directory does not affect rotation.

  • Run `logrotate -f /etc/logrotate.d/app` to force rotation immediately.

    Why it's wrong here

    This forces a rotation once but does not resolve why automatic rotation is not occurring.

  • Add a cron job to run logrotate hourly.

    Why it's wrong here

    logrotate already runs daily; hourly is excessive and does not fix the underlying issue.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

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 →

How Courseiva writes practice questions · Editorial policy

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.