Newbie: Writing console messages to a file FC2 2.6.5

Phil Schaffner Philip.R.Schaffner at NASA.GOV
Tue Aug 2 19:31:27 UTC 2005


On Tue, 2005-08-02 at 12:09 +0100, Clive at Rational wrote:
> Hello,
> 
>     I have an unreliable FC2 / 2.6.5 kernel machine. I
> am running it as a file server. From time to time the
> machine "hangs" or puts out lots of messages of the
> form
> 
> <+0x0nnnnnnn> ... debug info ...
> 
>    I am guessing these are kernel error messages. I
> want to capture these messages so I can post them when
> an error occurs. At the moment the messages are not
> written to any file that I can find - so I can't
> retreive them, then post them once I restart the
> machine.
> 
>    Now the reading I have done has got me as far this
> this .....
> 
>   The kernel messages are directed to the console
> because of the following setting
> 
> /etc/syslog.conf
> # Log all kernel messages to the console.
> # Logging much else clutters up the screen.
> kern.*	/dev/console
> 
> 
>    My question is
> 
> Can I change this to
> # Log all kernel messages to the console.
> # Logging much else clutters up the screen.
> kern.*	/syslog/CRLconsolelog

Probably want to log in /var/adm or /var/log.

> So all messages are written to a file?
> 
> Can I get the messages written to BOTH a file and the
> console at the same time?


The man page on syslog.conf has some examples:

       This will store all messages with the priority crit in the
file /var/adm/critical, except for any kernel message.

              # Kernel messages are first, stored in the kernel
              # file, critical messages and higher ones also go
              # to another host and to the console
              #
              kern.*                       /var/adm/kernel
              kern.crit                    @finlandia
              kern.crit                    /dev/console
              kern.info;kern.!err          /var/adm/kernel-info


> 
> Will this capture ALL Error messages that appear at
> the console?
> 
> What happens if the machine goes into a loop - I don't
> realise - and eventually the file fills the whole
> disk? Will I then be able to restart Linux?
> 
> Anyway of cycling this "kernel/console message" log
> file automatically?

Yes.  See /etc/logrotate.d/ for some examples, and the logrotate man
page.

Phil





More information about the fedora-list mailing list