Showing results for 
Search instead for 
Did you mean: 

can console log redirect?

Regular Advisor

can console log redirect?

hi all,

my PC is connected to a device through serial console. I want to redirect all the console messages I got on console to file.
console logs only generated upon system getting up/down, unexpected error occured etc.

Is it possible? if yes pl suggest how can i go further to collect console logs in a file on everytime when it getting generated?


Honored Contributor

Re: can console log redirect?

You can configure the /etc/syslog.conf to log kernel messages to files. You can use the dmesg command to display boot messages.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Occasional Advisor

Re: can console log redirect?

Which client do you use to connect to your serial console?
Most clients allow logging terminal communication to file.

E.g. In PuTTY you have to:
- select Serial in "Session" section
- fill COM number in "Serial line" field
- set log file name in "Logging" section
- select "All session output" or "Printable output" under Session logging.


Re: can console log redirect?

You can also tell the kernel to redirect all of it's console messages directly to the serial port. This is useful if you have a kernel which is panicing, since syslog doesn't usually record these messages.

If your using grub as a boot loader, edit /boot/grub/menu.lst (or grub.conf). Look for the "kernel" line of your active kernel. At the end of that line, add a parameter "console=ttyS0,9600n8" to the end. Of course, adjust for your actual serial port, speed, etc.

Note that if you make this adjustment, you won't see any kernel messages as your booting...they will be all redirecting to the serial port. You should still get a "login" prompt at the end, as long as you have adjusted your getty configuration (/etc/inittab)
Regular Advisor

Re: can console log redirect?

Thanks for information Steve!

As console log wipeouts So we need to redirect all those logs to a file. So that we can debug issue from it.