LFCS practice question 10 of 35

Which of the following commands is used to rotate, compress, and mail system logs?

Full set: 260 questions
Answer options
A: rotatelog
B: striplog
C: syslogd --rotate
D: logrotate Correct answer
E: logger
Correct Answer:
D. logrotate
Explanation

The logrotate utility is the standard Linux tool designed to manage log files. Its primary functions include automatic rotation, compression, removal, and mailing of log files. It can be configured to handle logs daily, weekly, monthly, or when they grow too large. The configuration in /etc/logrotate.conf and /etc/logrotate.d/ allows for granular control over these actions, making it an essential tool for system administration to prevent log files from consuming excessive disk space.

Why Incorrect

A. rotatelog is a simple log rotation tool typically used with the Apache HTTP Server, not a general-purpose system utility.
B. striplog is not a standard command for log rotation in common Linux distributions.
C. syslogd is a daemon that collects log messages; it does not have a built-in --rotate option for managing the log files themselves.
E. The logger command is used to add entries to the system log, not to manage or rotate the log files.

References

- Red Hat Enterprise Linux 8 Documentation, Section 25.1. "Getting started with logrotate". This section details the purpose and usage of the logrotate utility.

- logrotate(8) Linux manual page. It describes logrotate as a tool designed to "ease administration of systems that generate large numbers of log files."

- Ubuntu Server Guide, "Log Rotation". This guide explains that logrotate is installed by default to handle the rotation of all system log files.

Scroll to Top