LFCA · Question #52
Which is a common best practice to automatically reduce disk usage associated with the storage of log files?
The correct answer is A. Use the loqrotate utility to periodically rotate the loq files. The question seeks an automatic and common best practice for managing log file disk usage on Linux systems.
Question
Which is a common best practice to automatically reduce disk usage associated with the storage of log files?
Options
- AUse the loqrotate utility to periodically rotate the loq files.
- BCreate a cron job that deletes all log files in the folder every day.
- CDelete the Vvar/log" directory so the log files are prevented from being created.
- DManually empty the log files every day of the week.
How the community answered
(23 responses)- A87% (20)
- C9% (2)
- D4% (1)
Why each option
The question seeks an automatic and common best practice for managing log file disk usage on Linux systems.
The `logrotate` utility is specifically designed for automated log management on Linux systems, allowing for periodic rotation, compression, and deletion of log files. This process conserves disk space while retaining a history of logs for auditing and troubleshooting, adhering to best practices for log maintenance.
Deleting all log files daily via cron would destroy all historical log data, making troubleshooting and auditing impossible, which is not a best practice.
Deleting the `/var/log` directory would prevent most system and application logging, breaking system functionality and making it impossible to diagnose issues.
Manually emptying log files is not an automatic solution and is impractical and error-prone for ongoing system maintenance.
Concept tested: Linux log file management (logrotate)
Source: https://man7.org/linux/man-pages/man8/logrotate.8.html
Topics
Community Discussion
No community discussion yet for this question.