1830979 Members
2075 Online
110018 Solutions
New Discussion

Re: Console message

 
Ngoh Chean Siung
Super Advisor

Console message

Hi,

Is there any file that keep the console messages?

regards.
3 REPLIES 3
Michael Tully
Honored Contributor

Re: Console message

Try adding this entry to the /etc/syslog.conf file

*.alert /var/adm/syslog/syslog.log

Restart the syslog daemon:
# /sbin/init.d/syslogd stop
# /sbin/init.d/syslogd start
Anyone for a Mutiny ?
A. Clay Stephenson
Acclaimed Contributor

Re: Console message

While Michael's answer will almost certainly help; the precise answer to your question is no. Not every message that is sent to the console is sent via syslogd. You can also execute dmesg but that is a circular buffer of limited capacity but it would get a few more messages that syslogd might miss. A process could write directly to /dev/console and the only file (more properly a device node) that would receive those messages (in addition to those sent by syslogd, dmesg, et al) is /dev/console itself. If you absolutely, positively want to capture everything get yourself a hardcopyterminal (actually a printer with a keyboard). That's the way in was done in the good old days of UNIX and is still done that way in a few very mission critical cases. Plan B: Connect a PC as the console terminal and have its terminal emulation software write every incoming character to a file.
If it ain't broke, I can fix that.
Bill Hassell
Honored Contributor

Re: Console message

Well written Unix applications and processes will write to syslog (in HP-UX, /var/adm/syslog/syslog.log). However, kernel messages and some daemons can't take the time or store the code needed write to the syslog daemon and will instead write to the console. The dmesg command will show this buffer in memory. But as Clay mentioned, this buffer is limited in size and additional messages will push the older text off the top.

You can log dmesg regularly (and add a time stamp) by running a job like this from cron:

0,10,20,30,40,50 * * * * /usr/sbin/dmesg - >> /var/adm/dmesg.log

That will keep a permanent log of dmesg messages. Note: this just checks dmesg for changes from 10 minutes ago. If a lot of messages are sent to the console, only the most recent will be written to the log.

As Clay mentioned, a paper terminal or an electronic terminal logging device is needed to truly capture every message.


Bill Hassell, sysadmin