[Ilugc] [ILugC] Event logging and Syslog

  • From: girishvenkatachalam@xxxxxxxxx (Girish Venkatachalam)
  • Date: Sat, 14 Apr 2012 13:45:34 +0530

There are basic questions.

On Sat, Apr 14, 2012 at 11:35 AM, Yogesh Girikumar
<yogeshg1987 at gmail.com> wrote:

Hi,

I've been trying to look up event logging in Linux. But I don't seem to
find explanations to certain things.

https://tools.ietf.org/html/rfc5424

for e.g. What is a "Facility"? What are local0, local1 etc.

Can someone point me in the right direction? Maybe a link in plain English?


Facility is basically ..ok leave it.

Excerpt from man page syslog.conf on OpenBSD:

------------
 The facility describes the part of the system generating the message, and
     is one of the following keywords: auth, authpriv, cron, daemon, ftp,
     kern, lpr, mail, mark, news, syslog, user, uucp and local0 through
     local7.  These keywords (with the exception of mark) correspond to the
     similar ``LOG_'' values specified to the openlog(3) and syslog(3) library
     routines.

     The level describes the severity of the message, and is a keyword from
     the following ordered list (highest to lowest): emerg, alert, crit, err,
     warning, notice, info and debug.  These keywords correspond to the
     similar (LOG_) values specified to the syslog library routine.
-----------

Try this:

$ logger -t girish 'how r u'

Basically you can specify the filters for logging various facilities and
 their associated levels in /etc/syslog.conf

mail.*              /var/log/maillog
daemon.*        /var/log/daemon

And you can look at the perl Sys::Syslog module.

A typical C syslog program goes like:

openlog("girishcode", LOG_PERROR | LOG_PID, LOG_LOCAL0);

syslog(LOG_INFO,"Started code");

The syslog() function takes vararg arguments just like printf.

-Girish


-- 
G3 Tech
Networking appliance company
web: http://g3tech.in ?mail: girish at g3tech.in

Other related posts: