Configure Log Messages from Cron Utility to Console | XK0-004 Exam | CompTIA Linux+

Configuring Log Messages from Cron Utility to Console

Question

A Linux administrator wants to configure log messages of critical or higher severity levels from the cron utility to be logged to the console.

Which of the following will accomplish this objective?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

B.

The correct answer is B. Edit the /etc/rsyslog.conf file to include the line cron.emerg.* /dev/console.

Explanation: The cron utility is responsible for running scheduled tasks on a Linux system. By default, it logs messages to the syslog facility, which in turn can be directed to various log files or remote log servers using a syslog daemon like rsyslog.

To configure log messages of critical or higher severity levels from cron to be logged to the console, we need to modify the rsyslog configuration file (/etc/rsyslog.conf) to specify that messages of this severity should be sent to the console device (/dev/console).

The line to be added to the /etc/rsyslog.conf file is: cron.emerg.* /dev/console

This tells rsyslog to send messages with a facility of cron and a severity of emerg or higher to the console device.

Option A is incorrect because /etc/logrotate.d/cron is a log rotation configuration file for cron, not a syslog configuration file.

Option C is incorrect because /etc/logrotate.conf is the main log rotation configuration file and does not deal with syslog configuration.

Option D is incorrect because /etc/rsyslog.d/conf is a directory containing additional configuration files for rsyslog and not the main configuration file that needs to be modified.