views:

40

answers:

2

Is there a way one can use custom priorities in syslog daemon or rsyslog daemon? i.e. i am unable to locate a configuration change which achives it.. the other thing i can do is perhaps play with it's source.

Cheers!

A: 

The usual interface between the process that calls syslog(3) and the syslogd daemon only allows an int for the priority. This doesn't leave much room for application-specific priorities. Applications are expected to use the LOG_USER facility. There are 8 facilities LOG_LOCAL0 through LOG_LOCAL7 (sanctioned by POSIX) that can be used by applications. The allocation of these facilities is traditionally up to the system administrator, so you should make the facility a configuration setting with a default of LOG_USER (this will also allow the administrator to select a nonstandard facility).

Some syslog daemons, and most log sorting programs, allow sorting by application name (the first argument to openlog) in addition to facility and priority. This subject would be best discussed at the Unix Stack Exchange site.

Gilles
A: 

Is there a way one can use custom priorities in syslog daemon or rsyslog daemon?

Syslog output is something admins look into. And the syslog is managed by the user-space daemon.

What that means, if you would manage somehow to cram your own custom priorities into the syslog() call, the receiving side, likewise the users, wouldn't be able to make much out of them.

The priorities (or levels) as they are documented for the syslog() call are pretty straightforward, covering all levels of attentions admins has to pay to the error conditions. Because that is what the levels there are for.

I would recommend posing on the SO another question with details what you really want to achieve. Because inventing custom priorities is a step in wrong direction.

P.S. Otherwise, if it is some sort of tracing or debugging or diagnostic output, used only during development/testing/installation, you can always use one of the standard levels and distinct prefix in the log message. That's what I did on few occasions to be able to extract from the syslog (with grep) only the particular types of diagnostics.

Dummy00001