Cartesius00
Cartesius00

Reputation: 24374

syslog and LOCAL0..7

We have about 10 different daemons for which we would like to use syslog logging. It looks like that for custom applications you're supposed to use LOCAL0..LOCAL7 facilities. Well, how can one then differentiate between those 10 daemons if he has only 8 possible "sockets"?

For example, if we'd like to have one /var/log/daemon<x> file per each daemon.

Upvotes: 1

Views: 651

Answers (1)

Don't use different syslog facilities for that. Instead, pass LOG_PID option to openlog and configure appropriately your logger daemon thru syslog.conf, or perhaps use rsyslog or some other syslogger (there are many of them). openlog has a ident argument which can be used by logger dameons for discrimination & filtering of log messages.

And alternative would be to conventionally decide that logging should go to some application specific file under /var/log (i.e. use just <stdio.h> with fopen, fprintf but don't forget fflush). This is what many Linux servers (exim4, lighttpd, Xorg, ...) are doing. See also the Linux Standard Base which defines conventions.

Upvotes: 2

Related Questions