Subject: Re: Redirecting console output
To: Simon Raahauge DeSantis <xiamin@gay-robot.com>
From: Greg A. Woods <woods@weird.com>
List: netbsd-users
Date: 10/02/2003 14:47:47
[ On Thursday, October 2, 2003 at 12:00:05 (-0400), Simon Raahauge DeSantis wrote: ]
> Subject: Redirecting console output
>
> 	I'm wondering if there's a non-X version of xconsole. I'd like to 
> redirect the console output to somewhere else (an ssh session, or maybe 
> a file) temporarily. tail -f /dev/console doesn't seem to do the trick.

Are you concerned about anything other than kernel messages?

As far as I'm aware almost all kernel messages are caught and logged by
syslog, assuming you have syslog running and properly configured, and in
my systms the only other processes that should ever write to
/dev/console are init and the processes it explicitly starts with
/dev/console as their stdio (and of course the children of those
processes), so generally I don't care about non-kernel output sent to
/dev/console (and I've removed naughty code in base-OS programs that
were writing explicitly to /dev/console).  Every log message goes
through syslog and syslog writes every log message to appropriate log
files.

Only panic() messages cannot be logged by syslog, but no self-hosted
mechanism can catch them except a physical display on the console tty.

So, to catch panic() messages I also use conserver and serial consoles
on all production servers so that I also get a separate log of all
/dev/console activity regardless of whether it comes from the kernel
before or after a panic, or not.  Normally I find I only review those
logs to find panic() messages and when I have to review some human
activity on the console.

Now on FreeBSD there is some hack in the /dev/console driver such that
syslog sees non-kernel output written to /dev/console and thus their
syslog can log all kernel output.  I don't know if this is a good thing,
or a bad thing, but it can be quite confusing!  ;-)

Of course FreeBSD's hack is a self-hosted mechanism so is useless for
catching panic() messages.

-- 
						Greg A. Woods

+1 416 218-0098                  VE3TCP            RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com>          Secrets of the Weird <woods@weird.com>