Question 310 of 522
GNU and Unix CommandsmediumMultiple ChoiceObjective-mapped

Quick Answer

The correct answer is to change the rotation frequency to 'weekly' because the current 'daily' setting with 'rotate 7' and 'delaycompress' keeps two uncompressed logs at any time—the active log and the most recently rotated one—which violates the requirement that logs older than 7 days be compressed. The 'delaycompress' directive delays compression by exactly one rotation cycle, so with daily rotation, the log from yesterday remains uncompressed alongside today’s active log, making it appear as if compression happens immediately. On the LPIC-1 exam, this scenario tests your understanding of how 'delaycompress' interacts with rotation frequency and the 'rotate' count; a common trap is assuming 'delaycompress' alone ensures all older logs are compressed, when in fact it only skips compression on the most recent rotated file. To meet the 7-day requirement, switching to 'weekly' ensures only the current week’s log stays uncompressed, and all prior rotated logs are compressed. Memory tip: think of 'delaycompress' as “delay by one rotation”—so if you rotate daily, you delay by one day; if weekly, you delay by one week.

LPIC-1 GNU and Unix Commands Practice Question

This LPIC-1 practice question tests your understanding of gnu and unix commands. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

You are a Linux administrator for a company that runs a web server on a system with limited disk space. The web server logs are stored in /var/log/httpd/access_log and grow quickly. The operations team requires that the most recent logs be available for troubleshooting, but logs older than 7 days must be compressed to save space. You decide to implement log rotation using logrotate. The logrotate configuration file for httpd currently contains:

/var/log/httpd/*.log { daily rotate 7 compress delaycompress missingok notifempty sharedscripts postrotate /bin/systemctl reload httpd 2>/dev/null || true endscript

}

After applying this configuration, you notice that log files are being compressed immediately instead of after one rotation. What is the most likely cause and the correct step to fix this?

Clue words in this question

Noticing these words before you look at the options changes how you read each choice.

  • Clue: "most likely"

    Why it matters: Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.

  • Clue: "immediately / without restart"

    Why it matters: Time or reboot constraint — the correct answer must take effect right away without requiring a reboot or reload.

Question 1mediummultiple choice
Full question →

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

Change the rotation frequency to 'weekly' so that the most recent week's logs remain uncompressed and older logs are compressed.

Option B is correct because the configuration uses 'rotate 7' with 'daily' frequency, meaning seven daily rotations are kept. However, 'delaycompress' delays compression by one rotation, so the most recent rotated log remains uncompressed. With 'daily' rotation, the current log and the most recent rotated log are both uncompressed, which may appear as if compression happens immediately. Changing to 'weekly' ensures that only the most recent week's logs remain uncompressed, matching the requirement that logs older than 7 days are compressed.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

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

  • Remove the 'sharedscripts' directive to ensure the postrotate script runs for each log file individually.

    Why it's wrong here

    The sharedscripts directive does not affect compression timing; it only controls when the postrotate script runs.

  • Change the rotation frequency to 'weekly' so that the most recent week's logs remain uncompressed and older logs are compressed.

    Why this is correct

    With weekly rotation, the most recent rotated log (one week old) remains uncompressed due to delaycompress, while older logs are compressed, meeting the requirement of compressing logs older than 7 days.

    Clue confirmation

    The clue words "most likely", "immediately / without restart" in the question point toward this answer.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Remove the 'delaycompress' directive to ensure compression occurs at each rotation.

    Why it's wrong here

    Removing delaycompress would cause all rotated logs to be compressed immediately, including the most recent, which contradicts the requirement to keep recent logs uncompressed.

  • Add the 'copytruncate' directive to avoid moving the log file, allowing the web server to continue writing to the same file.

    Why it's wrong here

    copytruncate does not affect compression timing; it only changes how the log file is rotated.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates may misinterpret 'delaycompress' as causing immediate compression, when in fact it delays compression by one rotation, and the issue is actually the rotation frequency being too short relative to the retention period.

Detailed technical explanation

How to think about this question

The 'delaycompress' directive in logrotate works by postponing compression until the next rotation cycle. For example, with 'daily' rotation and 'rotate 7', the log file is rotated daily, and the previous day's log is compressed only after the next rotation occurs. This means that at any given time, two uncompressed log files exist: the current active log and the most recently rotated one. Changing to 'weekly' aligns the rotation frequency with the 7-day retention requirement, ensuring that only the current week's log remains uncompressed while all older rotated logs are compressed.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A practitioner preparing for the LPIC-1 exam encounters this exact type of scenario on the job. The correct answer here is not the most general option — it is the best answer for the specific constraint described. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Real exam questions reward reading the full scenario before eliminating options, because the constraint defines which answer fits.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related LPIC-1 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free LPIC-1 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this LPIC-1 question test?

GNU and Unix Commands — This question tests GNU and Unix Commands — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Change the rotation frequency to 'weekly' so that the most recent week's logs remain uncompressed and older logs are compressed. — Option B is correct because the configuration uses 'rotate 7' with 'daily' frequency, meaning seven daily rotations are kept. However, 'delaycompress' delays compression by one rotation, so the most recent rotated log remains uncompressed. With 'daily' rotation, the current log and the most recent rotated log are both uncompressed, which may appear as if compression happens immediately. Changing to 'weekly' ensures that only the most recent week's logs remain uncompressed, matching the requirement that logs older than 7 days are compressed.

What should I do if I get this LPIC-1 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Are there clue words in this question I should notice?

Yes — watch for: "most likely", "immediately / without restart". Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This LPIC-1 practice question is part of Courseiva's free LPI 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 LPIC-1 exam.