LPIC-1 Shells, Scripting and Data Management Practice Question
A systems administrator is responsible for a Linux server that runs a custom application. The application writes logs to /var/log/app.log and rotates them using logrotate. Recently, the server ran out of disk space because log files were not being rotated. The administrator checks the logrotate configuration file /etc/logrotate.d/app and finds:
/var/log/app.log { weekly rotate 4 compress missingok notifempty
}
The administrator manually runs 'logrotate -f /etc/logrotate.d/app' and the log rotates successfully. However, the next day, the log is not rotated again. The administrator checks the cron job for logrotate and finds that /etc/cron.daily/logrotate exists and runs logrotate /etc/logrotate.conf. The administrator checks /etc/logrotate.conf and sees that it includes /etc/logrotate.d/*. What is the most likely reason the log is not rotating automatically?
⚠ Common exam trap
The trap is that candidates focus on the misspelling of 'notifempty' (which is actually correct) and overlook the more fundamental issue that the 'weekly' directive only rotates logs once a week, causing the automatic daily check to skip rotation.
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
✓
The 'weekly' directive schedules rotation once per week, so the log will not be rotated again until a full week has passed.
The 'weekly' directive is correctly spelled and instructs logrotate to rotate the log once per week. The cron job runs daily, but logrotate will only rotate when the specified time interval (one week) has passed since the last rotation. The forced rotation with -f succeeded because -f overrides all conditions, including the time interval. The other options are incorrect: 'notifempty' is spelled correctly, /etc/logrotate.d/ is included via /etc/logrotate.conf, and 'missingok' is not the issue because the log file exists.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
The 'weekly' directive schedules rotation once per week, so the log will not be rotated again until a full week has passed.
Why this is correct
Although the word 'weekly' is not misspelled, this option points to the root cause: the 'weekly' frequency prevents daily rotation. The manual forced rotation works because -f forces rotation regardless of frequency.
- ✗
The 'notifempty' directive is misspelled; it should be 'notifempty'.
Why it's wrong here
Incorrect. 'notifempty' is the correct directive name; there is no misspelling. This directive prevents rotation if the log file is empty, but it is not the reason rotation fails.
- ✗
The /etc/logrotate.d/ directory is not included by logrotate.conf.
Why it's wrong here
Incorrect. /etc/logrotate.conf includes /etc/logrotate.d/*, so the configuration file is being processed.
- ✗
The 'missingok' directive prevents rotation if the log file is missing, but the file exists.
Why it's wrong here
Incorrect. 'missingok' allows rotation to proceed even if the log file is missing; it does not prevent rotation.
Go deeper
Related to this question
About these practice questions
Courseiva writes every LPIC-1 question from scratch — 527 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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 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.