Can't log to rsyslog with facility "kern" using logger command.

Solution Unverified - Updated -

Issue

  • How can I write or generate a message with the kern facility via rsyslog ?
  • Is it possible to write a message with kern facility to some file using the logger command?
  • When I run the command logger -p kern.info test, the log message is written to file with the user facility instead of the defined kern facility.Further more, the message is saved to the /var/log/messages file, instead of to the /var/log/kern.log file. As you can see with this one-liner, the message is saved to disk with the user facility, and to the messages file, while the kern.log is not updated.
[root@server ~]# date && logger -p kern.info "Now is: $(date)" && tail -1 messages && tail -1 kern.log
Mon Jan 25 18:38:24 CET 2016
Jan 25 18:38:24 <user.info> boom eu2246: Now is: Mon Jan 25 18:38:24 CET 2016
Jan 25 18:20:01 <kern.debug> boom kernel: SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs

To send messages with the kern facility to a separate log file, we use this configuration: kern.* /var/log/kern.log.

Environment

  • Red Hat Enterprise Linux (all versions)
  • rsyslog

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content