• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 852
  • Last Modified:

How to log message of kern.emerg using syslogd ?

I am typing the below command using 'logger' but I do not see kern.emerg priority I can see user.emerg priority instead. Could someone please let me know the reason behind this anomaly. Thanks!
logger -t genunix -p kern.emerg "pm0 is /pseudo/pm@0"
#tail -1 /var/adm/messages
Apr 28 05:27:10 sun10 genunix: [ID 702911 user.emerg] pm0 is /pseudo/pm@0

Open in new window

  • 2
1 Solution
By default, your syslog.conf file looks like:
kern.emerg           *
This means "Kernel emergency messages are forwarded to all logged-in users." which make sense in most case.
If you write the emergency messages to a file, eg /var/adm/messages, the trade off is the the users who are currently login will not see the warming messages on their screens.

beer9Author Commented:
below is the output from my /etc/syslog.conf file. My only concern is when I execute my command

logger -t genunix -p kern.emerg "pm0 is /pseudo/pm@0"

then instead of getting the kern.emerg why I am getting user.emerg in /var/adm/messages. Thanks!

Also what is '/dev/sysmsg' device?
bash-3.00# cat /etc/syslog.conf 
#ident  "@(#)syslog.conf        1.5     98/12/14 SMI"   /* SunOS 5.0 */
# Copyright (c) 1991-1998 by Sun Microsystems, Inc.
# All rights reserved.
# syslog configuration file.
# This file is processed by m4 so be careful to quote (`') names
# that match m4 reserved words.  Also, within ifdef's, arguments
# containing commas must be quoted.
*.err;kern.notice;auth.notice                   /dev/sysmsg
*.err;kern.debug;daemon.notice;mail.crit        /var/adm/messages
*.alert;kern.err;daemon.err                     operator
*.alert                                         root
*.emerg                                         *
# if a non-loghost machine chooses to have authentication messages
# sent to the loghost machine, un-comment out the following line:
#auth.notice                    ifdef(`LOGHOST', /var/log/authlog, @loghost)
mail.debug                      ifdef(`LOGHOST', /var/log/syslog, @loghost)
# non-loghost machines will use the following lines to cause "user"
# log messages to be logged locally.
ifdef(`LOGHOST', ,
user.err                                        /dev/sysmsg
user.err                                        /var/adm/messages
user.alert                                      `root, operator'
user.emerg                                      *
mail.info                                       /var/adm/maillog
mark.*                                          /dev/console

Open in new window

Brian UtterbackPrinciple Software EngineerCommented:
There actually isn't anyway to specify the kernel facility with the logger command. The syslog library call looks to see if a facility is given and if not, it substitutes "user". As it happens the "kernel" facility is facility 0, which the library call interprets as "none". I don't know if that is by accident or design, but either way, you can't do it with logger, or any other user land program that calls syslog from the c library.
beer9Author Commented:
Thanks blu! :-)

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now