May 2, 2011

How to log(write) facility and priority to syslog on Linux(RedHat)

On RHEL 5 or higher version.(CentOS 5 or higher ver.), logging the syslog facility and priority is possible.


Add -S or -SS to SYSLOGD_OPTIONS in /etc/sysconfig/syslog and restart the syslog service for the change to take effect.


example)

  $ cat /etc/sysconfig/syslog
  # Options to syslogd
  # -m 0 disables 'MARK' messages.
  # -r enables logging from remote machines
  # -x disables DNS lookups on messages recieved with -r
  # See syslogd(8) for more details
  SYSLOGD_OPTIONS="-m 0 -SS -r"
  $ service syslog restart



Now you can confirm the facility and priority in your syslog.
  $ cat /var/log messages

  May  1 04:02:02 helium syslogd 1.4.1: restart.
  May  2 13:09:55 helium kernel: Kernel logging (proc) stopped.
  May  2 13:09:55 helium kernel: Kernel log daemon terminating.
  May  2 13:09:57 helium exiting on signal 15 <-- before 
  May  2 13:09:57 helium syslogd 1.4.1: restart (remote reception). <-- after
  May  2 13:09:57 helium kernel: klogd 1.4.1, log source = /proc/kmsg started.
Post a Comment