2

I'm studying RHEL 7.

If I add this line to rsyslog.conf:

kern.notice      /dev/console

Where will the messages with facility "kernel" and priority "notice" be logged?

If I run this command:

logger -p kern.notice "Testing Log Entry"

Where will I see the message "Testing Log Entry"?

Jordanm:

How do I define the terminal for /dev/console? Right now I have made no changes to the basic installation. So when I run the command:

echo "Testing" > /dev/console

Nothing happens. Not even any error. So where will I see the logs directed to /dev/console?

  • 1
    It goes to the console (serial console or TTY, based on your configuration). – jordanm Oct 11 '15 at 5:05
  • Thank you. But where is this configuration done? Is there a configuration file where this is specified? – Sunshine Oct 11 '15 at 5:21
5

The console can be any tty device, including a virtual tty like /dev/tty1, a real tty like a serial port /dev/ttyS0, or a pseudo tty like /dev/pts/8.

The initial console is set at boot, and you can specify it with a boot option like console=ttyS0,9600, where 9600 is a baud rate. Usually on machines with graphics, it is the first virtual tty, which you can get to with chvt or ctrl-leftalt-1 or similar.

You can change the console by issuing ioctl(fd, TIOCCONS, 0), where fd is a tty, and you have sufficient permissions (typically root). See man tty_ioctl.

To experiment, there is a console on command in the screen utility that will make your pty the console, though you have to be root for it to work and your host must support the ioctl TIOCCONS.

0

Make sure that you have syslogd running. Make sure that your /etc/rsyslog.conf has the module for local logging enabled.

$ModLoad imuxsock # provides support for local system logging

You could always output to a file instead of the Console.

ie:
kern.notice      /var/log/kern.log

You can use tail -f /var/log/kern.log to view the log file output in real time from any console.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.