Archive for May 28th, 2011

Ubuntu real-time syslog logging to unused console TTY

Without going into a full run down on Ubuntu TTYs and how they work, there’s a very simple way to have Ubuntu log events in real-time to an unused TTY that you can access with a quick keystroke. This gives you the ability to see log events in real-time for easier troubleshooting.

This probably isn’t news to some. as it’s already written in the configuration file and just commented out, but I always seem to forget how to enable it, and I’m sure some other people would appreciate this.

First, what we’ll do is enable syslog to log events to an unused TTY. Edit /etc/rsyslog.d/50-default.conf and look for the following section:

#       news.=crit;news.=err;news.=notice;
#       *.=debug;*.=info;
#       *.=notice;*.=warn       /dev/tty8

You can use TTY8, but I prefer TTY12 for reasons that involve X. Change /dev/tty8 to /dev/tty12, and remove the # comment marks from all 4 lines to enable it. Save.

Restart the rsyslogd service:

/etc/init.d/rsyslogd restart

You could also use the upstart restart method:

restart rsyslog

Now you’ve got this set up, how do you view it? Press CTRL-ALT-F12 on your keyboard to go to TTY12 and view your real-time log. To get back to your X (GUI) session, CTRL-ALT-F7 or CTRL-ALT-F8 (X usually runs on TTY7, but can be running on TTY8 sometimes.)

Update 4/26/17:

Newer versions of syslogd may require a backslash or pipe symbol like in the two following example configs to work properly:

       *.=notice;*.=warn       |/dev/tty12
       *.=notice;*.=warn       /dev/tty12

Any thoughts or comments on the above? Please feel free to share them in the comments section below.

Leave a comment