A systems administrator is tasked with managing the log files for a custom application located at /var/log/app.log. The requirements are to rotate the log file once it reaches 100M, keep the 5 most recent rotated logs, and ensure that the old log files are compressed to save disk space. Which of the following logrotate configurations, placed in a file under /etc/logrotate.d/, will correctly implement these requirements?
/var/log/app.log {
maxsize 100M
keep 5
compression enabled
}
/var/log/app.log {
size 100M
rotate 5
compress
}
/var/log/app.log {
size 100M
rotate 5
delaycompress
}
The correct answer provides a logrotate configuration block that uses the size 100M, rotate 5, and compress directives. The size 100M directive tells logrotate to rotate the log when it grows larger than 100 megabytes. The rotate 5 directive specifies that 5 old log files should be kept. The compress directive enables compression for the rotated logs. The other options either use incorrect syntax, incorrect values, or omit required directives, failing to meet all the specified requirements.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the 'size' directive in logrotate do?
Open an interactive chat with Bash
How does the 'compress' directive work in logrotate?
Open an interactive chat with Bash
What is the difference between 'rotate' and 'keep' in logrotate configurations?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Security
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access